Silex (web framework)


Silex is a micro web framework written in PHP and based on Symfony, Twig and Doctrine. It is MIT Licensed.
The general purpose of Silex is to be as lightweight as you need it to be, as it is made for it to be as easy as possible to add features and extend the Silex base. Silex can be used for the creation of small web applications as this is the main case for micro frameworks, however Silex can be extended into a full stack MVC framework.
Silex comes in two available versions; 'fat' and 'slim'. The difference between these being that the fat version is fully featured and includes database abstraction, a template engine and various Symfony components. Whereas the slim version just comes with a basic routing engine.
Silex became end-of-life in June 2018 with people being encouraged to use Symfony instead.

Features

The base feature set is a URL routing system, built-in Web Security, Sessions and Cookies abstraction. The extended version of Silex features integration of Twig, Doctrine, a Translation service for translating your application into different languages, a logging mechanism using the Monolog library to log requests and errors, services for form validation and generation, and more.

History

Silex was originally created by Fabien Potencier, the creator of the Symfony framework, and Igor Wiedler. It was first released as a 'web framework proof-of-concept'.
Silex is now one of the best known micro frameworks for PHP and is regularly placed among the fastest in benchmarks for micro framework comparisons.

Example

The following code shows a simple web application that prints "Hello World!":

$app = new Silex\Application;
$app->get use;
$app->run;