Image may be NSFW.
Clik here to view.When faced with a new project, once the general requirements have been defined, we choose the technologies that we will use. If we take a look into the size of some projects, most aren’t very large. It is very common that they only consist of a RESTful API to communicate with the database and the View using, powerful front-end technology such as Angular.js or Backbone.js.
To cover these projects Josh Lockhart (@codeguy) created Slim Framework. The Slim Framework makes it easy to attach different PHP technologies to your project, create an API to access your database, and create your own agile development environment. An example is listed below. A complete presentation of the material discussed can be found here, along with easy examples of how to use it all together.
Slim Framework + Composer + Eloquent ORM + Twig
Slim Framework
Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs.
Slim is very light and easy to use.
index.php Hello World Example
$app = new \Slim\Slim(); $app->get('/hello/:name', function ($name) { echo "Hello, $name"; }); $app->run();
Composer
Composer is a tool for dependency management in PHP. It allows you to declare the dependent libraries your project needs and it will install them in your project for you.
The main composer repository is Packagist
Eloquent ORM
It is the ORM of Laravel (another PHP Framework) but there are another solutions like Doctrine or Propel
Twig
Twig is a flexible, fast, and secure template engine for PHP. It was created by SensioLabs and used in the PHP Framework Symfony.
It certainly is an interesting time for PHP for its flexibility, the apparition of different frameworks, and the recent version 5.5 that introduces significant new features.
For more info, see:
Full Presentation
Mixing and Matching PHP Components with Composer
Performance benchmark of popular PHP frameworks
What to expect in PHP 5.5