tourze / symfony-routing-auto-loader-bundle
Installs: 160
Dependents: 3
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- symfony/config: ^6.4
- symfony/dependency-injection: ^6.4
- symfony/framework-bundle: ^6.4
- symfony/http-kernel: ^6.4
- symfony/routing: ^6.4
- symfony/yaml: ^6.4 || ^7.1
Requires (Dev)
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^10.0
This package is auto-updated.
Last update: 2025-04-28 03:28:02 UTC
README
A Symfony bundle for automatically loading custom route collections via tagged services. This bundle allows you to define and register your own route loaders, which will be automatically merged into the application's routing system.
Features
- Auto-discover and load custom route collections via service tags
- Supports multiple route loaders
- Seamless integration with Symfony's routing component
- Simple interface for defining custom route providers
Installation
Requirements
- PHP 8.1+
- Symfony 6.4+
Install via Composer
composer require tourze/symfony-routing-auto-loader-bundle
Quick Start
- Define a class implementing
RoutingAutoLoaderInterface
use Tourze\RoutingAutoLoaderBundle\Service\RoutingAutoLoaderInterface; use Symfony\Component\Routing\RouteCollection; class MyRouteLoader implements RoutingAutoLoaderInterface { public function autoload(): RouteCollection { $routes = new RouteCollection(); // add routes ... return $routes; } }
- Register your loader as a service
# config/services.yaml services: App\Routing\MyRouteLoader: tags: ['routing.auto.loader']
- Routes will be auto-included in your app
Documentation
- Implement the
RoutingAutoLoaderInterface
and tag your service withrouting.auto.loader
. - All tagged services will be called and their routes merged into the main collection.
- Advanced: You can create multiple loaders for different modules or route groups.
Contribution
Contributions are welcome! Please submit issues or pull requests. Ensure code style and tests pass before submitting.
License
MIT License. See LICENSE for details.
Changelog
See the releases page for changelog and upgrade notes.