Silex (web framework)

Print Print
Reading time 3:24

Silex
Original author(s)Fabien Potencier and Igor Wiedler
Developer(s)Silex contributors, SensioLabs
Initial release16 September 2010 (2010-09-16)
Final release
2.3.0[1] / 20 April 2018 (2018-04-20)
Repository Edit this at Wikidata
Written inPHP
Operating systemCross-platform
TypeWeb framework
LicenseMIT License
Websitesilex.symfony.com Edit this at Wikidata

Silex is a micro web framework written in PHP and based on Symfony, Twig (template engine) and Doctrine (database abstraction). 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.[2] Silex can be used for the creation of small web applications (e.g. REST APIs) as this is the main case for micro frameworks,[3] however Silex can be extended into a full stack MVC framework.[4]

Silex comes in two available versions; 'fat' and 'slim'.[5] 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.[6][7]

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.[8]

History

Silex was originally created by Fabien Potencier, the creator of the Symfony framework, and Igor Wiedler.[9] It was first released 16 September 2010 (2010-09-16) as a 'web framework proof-of-concept'.[10]

Silex is now one of the best known micro frameworks for PHP[11] and is regularly placed among the fastest in benchmarks for micro framework comparisons.[12][13]

Example

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

$app = new Silex\Application();

$app->get('/', function() use($app) { 
    return 'Hello World!';
});

$app->run();

redirects
$app->get('/', function () use ($app) {
    return $app->redirect('/hello');
});

References

  1. ^ "Changelog". silex.symfony.com. Retrieved 30 May 2019.
  2. ^ "Writing Silex Service Providers".
  3. ^ "Scaling Silex".
  4. ^ "Silex from micro to full stack".
  5. ^ https://silex.symfony.com/download
  6. ^ https://github.com/silexphp/Silex
  7. ^ "The end of Silex".
  8. ^ "Silex Included Providers".
  9. ^ "Who is behind Silex?".
  10. ^ "Fabien Potencier: first tweet about Silex".
  11. ^ "Best available PHP restful microframeworks".
  12. ^ "Performance benchmark of popular PHP Frameworks".
  13. ^ "PHP Framework benchmark".

External links


By: Wikipedia.org
Edited: 2021-06-18 14:11:51
Source: Wikipedia.org