linio/tortilla
最新稳定版本:1.5.0
Composer 安装命令:
composer require linio/tortilla
包简介
A highly opinionated microframework built with speed and simplicity in mind.
README 文档
README
Linio Tortilla provides a very thin web abstraction layer built on top of FastRoute and Pimple. No frills, light and efficient. We believe that the web is just a delivery mechanism and no framework should dictate how you design the architecture of your applications.
And, just like a tasty super-thin tortilla, you can wrap it around anything you want.
Install
The recommended way to install Linio Tortilla is through composer.
{
"require": {
"linio/tortilla": "~1.2"
}
}
If you need help preparing your tortilla, there are recipes available:
$ composer create-project linio/burrito-recipe full_app
$ composer create-project linio/tortilla-recipe basic_app
Tests
To run the test suite, you need install the dependencies via composer, then run PHPUnit.
$ composer install
$ phpunit
Goals
- Efficiency at all costs
- Reduce, as much as possible, the amount of moving parts under the hood
- Tackle complexity
Usage
Preparing your tortilla is quite simple. This is an example of a simple front-controller:
<?php require '../vendor/autoload.php'; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Linio\Tortilla\Application; $app = new Application(); $app->get('/hello/{name}', function (Request $request, $name) { return new Response('Hello ' . $name); }); $app->run();
You can also define controllers as services instead of closures. Since a Tortilla application is also a Pimple container:
<?php require '../vendor/autoload.php'; use Linio\Tortilla\Application; $app = new Application(); $app['default'] = function () { return new Acme\Controller\DefaultController(); }; $app->get('/hello/{name}', 'default:indexAction'); $app->run();
Defining actions
The Linio Tortilla dispatcher will always dispatch the HTTP request to your controller actions as the first argument. The method signature looks like this:
use Symfony\Component\HttpFoundation\Request; public function yourAction(Request $request, $arg1, $arg2, ...);
We do this to keep the dispatching procedure efficient. If we decided to use PHP's reflection mechanism to decide whether to inject the request object or not, we would lose precious milliseconds.
统计信息
- 总下载量: 3k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 14
- 点击次数: 0
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2015-07-23