mi/rest-extra-bundle

Helper to avoid annotations with FOSRestBundle and SensioFrameworkExtraBundle

Installs: 10 572

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 5

Forks: 0

Open Issues: 0

Type:symfony-bundle

3.0.5 2021-06-29 13:58 UTC

This package is not auto-updated.

Last update: 2022-11-18 15:39:33 UTC


README

Build Status Latest Stable Version Latest Unstable Version Total Downloads License

Overview

...

Installation

  1. Add this bundle to your project as a composer dependency:
composer require mi/rest-extra-bundle
  1. Add this bundle in your application kernel:

    // app/AppKernel.php
    public function registerBundles()
    {
        // ...
        $bundles[] = new \Mi\Bundle\RestExtraBundle\MiRestExtraBundle();
    
        return $bundles;
    }

Usage

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

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

This library is under the MIT license.