handcraftedinthealps / rest-routing-bundle
This bundle provides automatic route registration for the Controllers
Installs: 1 559 802
Dependents: 3
Suggesters: 0
Security: 0
Stars: 56
Watchers: 3
Forks: 8
Open Issues: 1
Type:symfony-bundle
Requires
- php: ^7.2 || ^8.0
- doctrine/annotations: ^1.0|^2.0
- doctrine/inflector: ^1.4.1|^2.0
- symfony/config: ^4.4|^5.0|^6.0|^7.0
- symfony/console: ^4.4|^5.0|^6.0|^7.0
- symfony/dependency-injection: ^4.4|^5.0|^6.0|^7.0
- symfony/finder: ^4.4|^5.0|^6.0|^7.0
- symfony/framework-bundle: ^4.4.1|^5.0|^6.0|^7.0
- symfony/http-kernel: ^4.4|^5.0|^6.0|^7.0
- symfony/routing: ^4.4|^5.0|^6.0|^7.0
Requires (Dev)
- friendsofsymfony/rest-bundle: ^2.8 || ^3.0
- php-cs-fixer/shim: ^3.6
- psr/http-message: ^1.0
- symfony/http-foundation: ^4.4|^5.0|^6.0|^7.0
- symfony/phpunit-bridge: ^5.4.33|^6.3.10|^7.0.1
- symfony/security-core: ^3.4|^4.3|^5.0|^6.0|^7.0
- symfony/serializer: ^4.4|^5.0|^6.0|^7.0
- symfony/validator: ^4.4|^5.0|^6.0|^7.0
- symfony/yaml: ^4.4|^5.0|^6.0|^7.0
Conflicts
README
This bundle provides the automatic route generation for the FOSRestBundle 3.0.
Documentation
Installation
All the installation instructions are located in the documentation.
Opt-out of the type: rest
routing
You might want to migrate away from this bundle and use normal Symfony routes.
Via the command inside this bundle you can convert all type: rest
routes to normal Symfony routes:
bin/console fos:rest:routing:dump-symfony-routes # filter by a specific controller bin/console fos:rest:routing:dump-symfony-routes --controller="your.controller.service" # filter by a specific name prefix bin/console fos:rest:routing:dump-symfony-routes --name-prefix="your_prefix."
Copy the result into a routing.yaml
file of your choice.
Switching from FOSRestBundle
If you did before using the FOSRestBundle which removed the auto route generation the switch is easy. After you did successfully install the bundle change the configuration to the new bundle:
before
fos_rest: routing_loader: default_format: 'json' prefix_methods: true include_format: true
after
handcraftedinthealps_rest_routing: routing_loader: default_format: 'json' prefix_methods: true include_format: true # optional set supported formats else the configured one from fos_rest are used if installed: # formats: # json: true # xml: true
Update the classes (not necessary but recommended):
// Replace ClassResourceInterface -use FOS\RestBundle\Routing\ClassResourceInterface; +use HandcraftedInTheAlps\RestRoutingBundle\Routing\ClassResourceInterface; // Replace RouteResource -use FOS\RestBundle\Controller\Annotations\RouteResource; +use HandcraftedInTheAlps\RestRoutingBundle\Controller\Annotations\RouteResource; // Replace NamePrefix -use FOS\RestBundle\Controller\Annotations\NamePrefix; +use HandcraftedInTheAlps\RestRoutingBundle\Controller\Annotations\NamePrefix; // Replace Prefix -use FOS\RestBundle\Controller\Annotations\Prefix; +use HandcraftedInTheAlps\RestRoutingBundle\Controller\Annotations\Prefix; // Replace NoRoute -use FOS\RestBundle\Controller\Annotations\NoRoute; +use HandcraftedInTheAlps\RestRoutingBundle\Controller\Annotations\NoRoute; // Replace Version -use FOS\RestBundle\Controller\Annotations\Version; +use HandcraftedInTheAlps\RestRoutingBundle\Controller\Annotations\Version;
License
This bundle is under the MIT license. See the complete license in the bundle.