[Extension] Backvendor
All tips and tricks of backvendor

A short time ago we announced backvendor– a new Yii extension aimed to automate web-service development process. We are grateful to everyone who decided to try our product. Today we are glad to inform that the army of backvendor users is growing and you can find new tutorials that people post on the Web. A short and clear tutorial designated to fast web-service creation was posted on Sitepoint several days ago. Due to its simplicity we recommend it for all interested developers.

We would be glad if you try backvendor and share your ideas about its improvement.

I am going to use a front-end js framework (Knockout.js most probably) and thus Yii is only going to be used for the backend.
So, no views, templates, assets - only the API interface.

Is Backvendor suited for a scenario like that?

Yes, you are able to use API only.
Backvendor provide basic skeleton for creating custom API.
Actually Backvendor creates 3 Yii apps - backend, frontend and api (+core).
So as I understand you will need to make only one view in fronted Yii app - where you One Page Site will be initialized. And from JS frontend app you will need to make requests to API Yii app to get data etc.

Hi friends! Our developer wrote an article about Backvendor. It can be useful for you.

Application structure - is one of the main reasons why PHP programmers evolves from wheel-inventors to framework users. Strict agreement of app structure and naming conventions allows us to get rid of tons of code, to make app workflow predictable and to consolidate team efforts for quick and quality writing valuable business functions - without eternal refactoring of routers, controllers etc.

Yii Framework has console command to generate basic application skeleton that allow almost immediately to start working on web app. And Gii Module allows to generate classes boilerplates for models, controllers and generic CRUD interface. But if your application functionality is beyond bounds of the simple web site - framework by itself already does not have built in helpers to generate core complex architecture.

And besides of all good schemas of app structure organization are described and well know (actually not so “well” ) it does not free us from making those boilerplate construction from time to time in new projects. Here comes to help - readymade application structure skeletons.

Let’s consider big web system with : frontend (web site for ordinary uses), backend (admin panel to manage web app) and web service API (to let mobile apps, for example, to interact with your web application). Such a structure should allow shared core with business models usage, scaling app in future and physical separation parts of application among different servers.

To quickly deploy such an app structure we can use for example open solutions from companies Clevertec, MobiDev or Herzogkommunikation. Mainly these solutions are application skeletons that could be used in all kinds of projects from small web site to big systems as described above (gladly Yii framework in any case will not require to write a lof auxiliary code even for a small project that uses scalable architecture).
So let’s try to look on advantages and weak of these solutions.

Killer feature :
- Composer based
Pros :
- A lot more that just app skeleton
- Using composer you can setup a CMS like solution (user management, RBAC, )
- Twitter bootstrap GUI
- Extended DB migrations
Cons :
- A lot more that just app skeleton
yes this is one of advantages, but for some projects it could be a biggest disadvantages - in a lot of cases you will not need all of this

One of the best solution currently at my point of view.
Also it has a number of related projects as YiiBackboneBoilerplate (https://github.com/c...boneBoilerplate) to provide web service structure for Backbone.js JS apps and Yii-Booster (http://yii-booster.clevertech.biz/) that integrates some YiiBootstrap ext. features with own modules like Grids etc. - combining these 3 you can easily get starting ground almost for all types of apps.

Killer features :
- Versioned web service engine with autogenerated documentation
Pros :
- Phing based deployment script
- Backend pages extension that automatically handle AR models relations and show related entities (allow to do basic admin interface with ability to manage all relations in very short time)
- Extendable JSON web service API structure
Cons :
- All components tightly coupled
- App skeleton generator is made as Yii application by itself, so if you want to modify it’s output it will be a little harder

So what is the conclusion ?
At my point of view - there is no ideal solution yet and I bet there will never be such suitable for everyone And my dream YiiAppBoilerplate is not created yet as it should be structured as well as YiiBoilerplate, I should be able to extend it via package manager as Phundament and I’d rather want some extensions like JSON web service and separated Backend pages extension from Backvendor.
Let’s hope that as rumored Yii2 will have Composer packages manager support, Twitter Bootstrap bundled and different app skeleton generators (for basic and decoupled application) out of the box - then hopefully will not need any 3-rd party structural framewoks upon Yii and custom own conposer.json in our new projects will be enough.