Setup Restful Api In Yii2

Hi everyone,

I would like to share my tutorial how to setup API in Yii2. It is written on my blog

I used Yii2 advanced template and created dedicated for API folder. I also wrote about the configuration you should made for make it works. I hope it can help someone who want to build RESTful API in Yii2. Any suggestion are welcome!

Thank you :)

Hello Bhoo-day,

great post, can you explain this for yii 1.x

im trying to achieve api communication securely between two yii apps

example i have two fresh yii 1.x blog demo apps, blogA and blogB, how do i get blogB to authenticate and fetch posts securely from blogA

can you explain or point me in the right direction on how to configure blogA so other apps can securely authenticate and communicate with it.


it’s a great explanation Bhoo-day, but I have a problem when I want to add new extra action. I have add my new action in CountryController that return “Hello World” and I add extraPattern to your config file, but when I test the api using postman “Object not found”.

Would you like explain, how is the right configuration about my problem?