mi / rest-extra-bundle
辅助工具,用于避免使用 FOSRestBundle 和 SensioFrameworkExtraBundle 时的注解
3.0.5
2021-06-29 13:58 UTC
Requires
- php: ^8.0
- friendsofsymfony/rest-bundle: ^3.0
- sensio/framework-extra-bundle: ^6.1
Requires (Dev)
README
概述
...
安装
- 将此包添加到项目的 composer 依赖中
composer require mi/rest-extra-bundle
-
将此包添加到应用程序内核中
// app/AppKernel.php public function registerBundles() { // ... $bundles[] = new \Mi\Bundle\RestExtraBundle\MiRestExtraBundle(); return $bundles; }
用法
ParamConverterListener
```yaml
#routing.yml
mi_rest_extra_create:
...
defaults:
...
_converters:
note:
name: note
converter: fos_rest.request_body
class: Mi\RestExtra\Core\Model\Note
```
ParamFetcherListener
```yaml
#routing.yml
mi_rest_extra_create:
...
defaults:
...
_params:
startDate:
strict: true
nullable: false
```
ViewListener
```yaml
#routing.yml
mi_rest_extra_create:
...
defaults:
...
_view:
serializerGroups: [list]
```
贡献
- 分支它
- 创建您的功能分支 (
git checkout -b my-new-feature
) - 提交您的更改 (
git commit -am '添加一些功能'
) - 推送到分支 (
git push origin my-new-feature
) - 创建新的 Pull Request
许可证
此库采用 MIT 许可证。