REST only application


(Jacob Moen) #1

I want to create the frontend in Elm, and my Yii application should be just backend, no views, not even an admin section.

I’ve seen lots of examples of using the advanced application template for this, but I don’t want the second application.

So, my application is only going to be made of console / REST - using modules for versioning.

Any exisiting Yii projects I could take a look at / learn from ?


(Alirz23) #2

I don’t have an example but you could have your elm source as part of your php application and use elm build tools to compile elm to whatever directory you like.


(Jacob Moen) #3

I think I can handle Elm. :)

It’s the Yii backend that I am more concerned about.

I guess I just have to dive right into it, then.

What I want is a REST-only Yii application - with no routing/views/backends … only a REST API endpoint.


(Jacob Moen) #4

The closest I’ve found is this : https://github.com/g...bjeka/yii2-rest

It is, unfortunately, based on the advanced app template.

Also, this article is basing it on the adv templ : https://code.tutsplu…-api–cms-27682

I don’t want to couple the frontend with the backend, because that will defeat the purpose: the ability to create different frontends, JS, JS-free and desktop applications, even terminal apps (ncurses!).

Anyone has experience with building a REST only Yii application?

I would be interested in hearing your experiences, pros / cons and gotchas.


(Jacob Moen) #5

I am going to be using Cebe’s assetfree-yii2 instead of requiring Yii2 directly because my REST app doesn’t need any assets.


(Jacob Moen) #6

I found 2 interesting Yii2 REST application templates that could be modified to suit my requirements:

I will probably create my own application template, and will of course post a link to it here once it’s done.


(Alexander Makarov) #7

Would be cool.


(Jacob Moen) #8

I am working on it - here is what I’ve got so far:

https://packagist.or…yii2-rest-alone

Complete without a frontend, or even assets, featuring Codeception API tests and simple query param auth.

Need to write a bit of documentation :)

I used https://github.com/p...ii2-minimal-api as a starting point.

I consider this application template feature complete for the time being - application specific features like models, rate limiting and more advanced auth is not something that I feel belong in a general purpose application template.

Comments and pull requests would always be appreciated. :)