Rest Controller + Crud Controller

Is there any way I can write controllers like in Rails, which will respond with JSON/XML (serialization) or HTML (view file) according to the request?

As long as I saw, I would need two separate controllers in Yii.

Yes you can

See this

So inside each action I will have to check all response formats? Is there any out-of-the-box way to do this?

Yes there is.

See this

I read that today and I just didn’t pay attention to the content negotiators. Thanks for your help!