Symfony a RESTFul app: Motivation

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:

overview

In an article by  about the model developed by Leonard Richardson it describe the break down of the levels of a RESTFul app. This post series will also aim to reach the glory of rest.

Code Requirements:

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 git@github.com:bitgandtter/k8s_php_test.git
git branch BRANCH_NAME
cd k8s_php_test

Build image

bash development_tools/cluster_config/app/build-image.sh

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

bash development_tools/cluster_config/get_pods_and_services.sh

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:

  1. Motivation
  2. REST Levels 0, 1, 2 ( FOSRestBundle, JMSSerializerBundle )
  3. REST Levels 0, 1, 2 ( FOSUserBundle )
  4. REST Levels 0, 1, 2 ( NelmioApiDocBundle )
  5. REST Levels 3 ( BazingaHateoasBundle )
  6. Security ( FOSOAuthServerBundle )
  7. Security ( Securing the token path )
  8. Security ( Securing the token path – FIXED )
Advertisements

7 Comments

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s