spacer
SILEX

The PHP micro-framework
based on the Symfony2 Components

  • DOCUMENTATION
  • DOWNLOAD
  • DEVELOPMENT
  • CONTRIBUTORS

A PHP micro-framework standing on the shoulder of giants

Silex is a PHP microframework for PHP 5.3. It is built on the shoulders of Symfony2 and Pimple and also inspired by sinatra.

A microframework provides the guts for building simple single-file apps. Silex aims to be:

  • Concise: Silex exposes an intuitive and concise API that is fun to use.
  • Extensible: Silex has an extension system based around the Pimple micro service-container that makes it even easier to tie in third party libraries.
  • Testable: Silex uses Symfony2's HttpKernel which abstracts request and response. This makes it very easy to test apps and the framework itself. It also respects the HTTP specification and encourages its proper use.
  • spacer
  • spacer

In a nutshell, you define controllers and map them to routes, all in one step:

require_once __DIR__.'/../vendor/autoload.php'; 

$app = new Silex\Application(); 

$app->get('/hello/{name}', function($name) use($app) { 
    return 'Hello '.$app->escape($name); 
}); 

$app->run(); 

All that is needed to get access to the Framework is to include the autoloader.

Next we define a route to /hello/{name} that matches for GET requests. When the route matches, the function is executed and the return value is sent back to the client.

Finally, the app is run. It's really that easy! Installing Silex is as easy as it can get. Download the archive file, extract it, and you're done!

Want to learn more? Read the documentation.

Who is behind Silex?

Silex is brought to you by Fabien Potencier, the creator of the Symfony framework, and Igor Wiedler. Silex is released under the MIT license.

This website is powered by Silex and Twig. The Silex logo is © 2010,2011 Sensio Labs
gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.