Silex is a micro
web framework
A web framework (WF) or web application framework (WAF) is a software framework that is designed to support the development of web applications including web services, web resources, and web APIs. Web frameworks provide a standard way to build an ...
written in
PHP
PHP is a General-purpose programming language, general-purpose scripting language geared toward web development. It was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1993 and released in 1995. The PHP reference implementati ...
and based on
Symfony
Symfony is a free and open-source PHP web application framework and a set of reusable PHP component libraries. It was published as free software on October 18, 2005, and released under the MIT license.
Goal
Symfony aims to speed up the creat ...
,
Twig (template engine)
Twig is a template engine for the PHP programming language. Its syntax originates from Jinja and Django templates. It's an open source product licensed under a BSD License and maintained by Fabien Potencier. The initial version was created b ...
and
Doctrine (database abstraction). It is
MIT License
The MIT License is a permissive free software license originating at the Massachusetts Institute of Technology (MIT) in the late 1980s. As a permissive license, it puts only very limited restriction on reuse and has, therefore, high license co ...
d.
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 (e.g.
REST APIs) 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
A Uniform Resource Locator (URL), colloquially termed as a web address, is a reference to a web resource that specifies its location on a computer network and a mechanism for retrieving it. A URL is a specific type of Uniform Resource Identifi ...
routing system, built-in
Web Security,
Sessions and
Cookies
A cookie is a baked or cooked snack or dessert that is typically small, flat and sweet. It usually contains flour, sugar, egg, and some type of oil, fat, or butter. It may include other ingredients such as raisins, oats, chocolate chips, n ...
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 was at its time one of the best known micro frameworks for PHP and was regularly placed among the fastest in benchmarks for micro framework comparisons.
Example
The following code shows a simple web application that prints "
Hello World
''Hello'' is a salutation or greeting in the English language. It is first attested in writing from 1826. Early uses
''Hello'', with that spelling, was used in publications in the U.S. as early as the 18 October 1826 edition of the '' Norwich ...
!":
$app = new Silex\Application();
$app->get('/', function() use($app) );
$app->run();
See also
*
Symfony
Symfony is a free and open-source PHP web application framework and a set of reusable PHP component libraries. It was published as free software on October 18, 2005, and released under the MIT license.
Goal
Symfony aims to speed up the creat ...
*
Comparison of web frameworks Two comparisons of web frameworks are available:
* Comparison of JavaScript-based web frameworks (front-end)
* Comparison of server-side web frameworks
This is a comparison of notable web frameworks, software used to build and deploy web applica ...
References
External links
*
{{Web frameworks
Free software programmed in PHP
PHP frameworks
Software using the MIT license
Web frameworks