This post series its about how to build a RESTFul app with Symfony2. There is a whole project about it, but i think its kind of outdated; but this series is about how do it by your self layer by layer. RESTFul apps are more and more popular this days. In my opinion a better approach to build your app, this enable you to build SPA and prepare your self to the mobile world, today business that do not target mobile apps are limiting the scope and the expansion of the app.
RESTFul the concept:
As defined on wikipedia:
The architectural properties of REST are realized by applying specific interaction constraints to components, connectors, and data elements. One can characterise applications conforming to the REST constraints described in this section as “RESTful”. If a service violates any of the required constraints, it cannot be considered RESTful. Complying with these constraints, and thus conforming to the REST architectural style, enables any kind of distributed hypermedia system to have desirable non-functional properties, such as performance, scalability, simplicity, modifiability, visibility, portability, and reliability.
The glory of REST:
NOTE: This series post will require you to know basic symfony and composer commands usage as well as symfony terminologies.
NOTE: Each post on the series will own its own branch, for the sake of this post i will use BRANCH_NAME to refer the branch you should checkout on each post
Clone the project
git clone email@example.com:bitgandtter/k8s_php_test.git git branch BRANCH_NAME cd k8s_php_test
Create kubernetes replication controller and services for app and mysql
bash development_tools/cluster_config/app/create.sh bash development_tools/cluster_config/mysql/create.sh
Update symfony vendors
cd framework composer update
Ensure cache and logs permissions
chmod -R 777 app/cache chmod -R 777 app/logs
Check kubernetes services ips
With this steps you should be set to start hacking.
This series will be composed of this articles that im going to be writing in the upcoming days:
- REST Levels 0, 1, 2 ( FOSRestBundle, JMSSerializerBundle )
- REST Levels 0, 1, 2 ( FOSUserBundle )
- REST Levels 0, 1, 2 ( NelmioApiDocBundle )
- REST Levels 3 ( BazingaHateoasBundle )
- Security ( FOSOAuthServerBundle )
- Security ( Securing the token path )
- Security ( Securing the token path – FIXED )