Silex - 基于Symfony2组件的微型框架
openkk
12年前
Silex 是一个PHP 5.3的微型框架。基于Symfony2 和 Pimple 构建。同时还受到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.
示例代码:
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();