rawebone / wilson
一款专为简洁和性能而设计的PHP微型框架
1.0.0-alpha3
2015-01-28 22:12 UTC
Requires (Dev)
- phpspec/prophecy-phpunit: 1.0.*
- phpunit/phpunit: 4.3.*
This package is not auto-updated.
Last update: 2024-09-24 02:37:14 UTC
README
Wilson是一款专为简洁和性能而设计的PHP微型框架。其主要特性包括:
- 基于注解的路由
- 中间件
- 服务定位
- HTTP请求/响应抽象
- HTTP缓存
- 单元测试
其设计基于Slim和Symfony框架,旨在结合两者的元素,以创建一个快速、正确、文档完善且简单的系统。
用法
从外观上看,框架中的应用程序如下所示
<?php // File: public/index.php require_once "/path/to/vendor/autoload.php"; $api = new Wilson\Api(); $api->resources = array("My\Restful\ResourceA"); $api->dispatch();
<?php // File: src/My/Restful/ResourceA.php namespace My\Restful; class ResourceA { /** * @route GET /resource-a/ */ function getCollection($request, $response, $services) { $response->json(array("a", "b", "c")); } /** * @route GET /resource-a/{file}.md * @where file [a-z]+ */ function getRecord($request, $response, $services) { $response->setBody(get_file($request->getParam("file"))); $response->setHeader("Content-Type", "text/plain"); } }
请查看wiki以了解功能指南。
致谢
此框架是由众多其他项目中的想法和代码片段拼凑而成的
- Josh Lockhart和Slim Framework的其他贡献者
- Fabien Potencier和Symfony的其他贡献者
- Matthew Weier O'Phinney和phly/http的其他贡献者
许可证
代码在MIT许可证下。第三方代码许可证