manticora / rest-extra-bundle
Symfony Rest 服务实用工具
0.1
2014-04-14 10:54 UTC
Requires
- symfony/expression-language: ~2.4
- symfony/framework-bundle: ~2.3
- symfony/routing: ~2.4
This package is not auto-updated.
Last update: 2024-09-24 07:13:17 UTC
README
Symfony Rest 服务实用工具
用法
路由表达式语言注入
通过注入路由表达式语言,您可以在路由条件中使用自定义表达式语言类,该类包含用于版本控制 REST Web 服务的 PHP version_compare 函数
/** * @Get("notes", condition="compare(request.attributes.get('version'),'1', '<')") */ public function cgetAction() { return $this->getRepository()->findAll(); } /** * @Get("notes", condition="compare(request.attributes.get('version'),'1', '>=')") */ public function cgetNewVersionAction() { echo 'new version'; return $this->getRepository()->findAll(); }
安装
下载包
在您的 composer.json 文件中添加以下行
{
"require": {
"manticora/rest-extra-bundle": "0.1"
}
}
现在,运行 composer.phar 下载包
$ php composer.phar install
注意:您可以直接开始使用。自动加载文件已由 composer 生成,并已包含到应用程序的自动加载文件中。
第二步:启用包
最后,在 kernel 中启用包
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Manticora\RestExtraBundle\ManticoraRestExtraBundle(), ); }
待办事项
- JSON 补丁
- URL 匹配器重写
- AbstractHalRepository
- Hal 测试实用工具
- JMS Serializer Group Strategy 重写
- 分页表示重写
许可协议
RestExtraBundle 在 MIT 许可协议下发布。有关详细信息,请参阅捆绑包中的 LICENSE 文件。