mi/rest-extra-bundle

辅助工具,用于避免使用 FOSRestBundle 和 SensioFrameworkExtraBundle 时的注解

安装数: 14,474

依赖者: 0

建议者: 0

安全: 0

星标: 0

关注者: 5

分支: 0

开放问题: 0

类型:symfony-bundle

3.0.5 2021-06-29 13:58 UTC

This package is not auto-updated.

Last update: 2024-09-21 00:24:28 UTC


README

Build Status Latest Stable Version Latest Unstable Version Total Downloads License

概述

...

安装

  1. 将此包添加到项目的 composer 依赖中
composer require mi/rest-extra-bundle
  1. 将此包添加到应用程序内核中

    // 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]
```

贡献

  1. 分支它
  2. 创建您的功能分支 (git checkout -b my-new-feature)
  3. 提交您的更改 (git commit -am '添加一些功能')
  4. 推送到分支 (git push origin my-new-feature)
  5. 创建新的 Pull Request

许可证

此库采用 MIT 许可证