HowTo: Build an RESTful API with Yii

is what I’am searching for.

Is it currently possible to create an rest API with Yii?

If yes, is there any documentation?


I’am also looking for a rest api. The only thing I found is this:

I will try it out the next days.

Same here - looking for a REST Api for yii to use instead of the built-in SOAP one

Here is a good web services framework that can compliment your yii app -


REST is relatively easy.

Once you know how.

Fortunately, there are people out there who have written some good articles on the subject:


The latter even got two repos on Github. :)

Made for CodeIgniter, but it is simple and similar enough, so that could be ported to our Yii apps easily.

I am going to go that route.

Maybe with the help of this patch:

SOAP is more powerful, of course.

But a simple REST implementation shouldn’t be too hard.

Would be awesome to have the functionality in the Yii framework, but … :)

I dug a bit deeper into this and discovered that the Pogostick Yii Extensions has REST ‘stuff’ in it:

Have any of you succesfully used that to make your app serve rest requests? :)

I had a look at the patch enabling the REST API.

The example provided is as followed:


    'articles' => array('articles/index', 'httpMethod' => 'GET'),

    'articles/<id:\d+>' => array('articles/show', 'httpMethod' => 'GET'),

    'articles' => array('articles/create', 'httpMethod' => 'POST'), 

    'articles/<id:\d+>' => array('articles/update', 'httpMethod' => 'PUT'),

    'articles/<id:\d+>' => array('articles/update', 'httpMethod' => 'POST'),

    'articles' => array('articles/delete', 'httpMethod' => 'DELETE'),  


Correct me if I’m wrong but it looks like the above array of rules will become the following:


    'articles/<id:\d+>' => array('articles/update', 'httpMethod' => 'POST'),

    'articles' => array('articles/delete', 'httpMethod' => 'DELETE'),  


as same array indexes are used multiple time, only the last would remain?

Therefore, once the article update using PUT or POST method will be declared, the article show using the GET method won’t be recognised?

Has anyone used it that way?



Mini-howto here: