Home >Backend Development >PHP Tutorial >PHP微框架:Bullet

PHP微框架:Bullet

WBOY
WBOYOriginal
2016-06-20 12:52:391622browse

Bullet 是一个实用的 PHP 微框架,它可以让你十分容易地创建 REST API 和自动顺应 HTTP 标准需求的 Web 应用程序。Bullet 是一种资源,URI 导向,并且预装了强大的 HTTP 功能,例如内容协商和 caching。它有以下两个优点:

  • 超灵活的路径

  • 减少重复代码(DRY)

示例代码:

$app = new Bullet\App();$app->path('foo', function($request) use($app) {    return "foo";});$app->path('bar', function($request) use($app) {    $foo = $app->run('GET', 'foo'); // $foo is now a `Bullet\Response` instance    return $foo->content() . "bar";});echo $app->run('GET', 'bar'); // echos 'foobar' with a 200 OK status

项目主页:http://www.open-open.com/lib/view/home/1437227078006

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn