{"id":15025718,"url":"https://github.com/deprecated-packages/symfonymodularrouting","last_synced_at":"2025-04-09T20:04:41.216Z","repository":{"id":57063820,"uuid":"50031822","full_name":"deprecated-packages/SymfonyModularRouting","owner":"deprecated-packages","description":"[DEPRECATED] Decouple your Symfony routing to independent, standalone services.","archived":false,"fork":false,"pushed_at":"2017-06-12T21:14:39.000Z","size":73,"stargazers_count":17,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-09T20:04:32.060Z","etag":null,"topics":["modular","php","php71","routing","symfony","symfony32","symplify"],"latest_commit_sha":null,"homepage":"https://www.tomasvotruba.cz/blog/2016/02/25/modular-routing-in-symfony/","language":"PHP","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deprecated-packages.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-20T13:28:13.000Z","updated_at":"2023-08-11T06:10:28.000Z","dependencies_parsed_at":"2022-08-24T07:50:15.198Z","dependency_job_id":null,"html_url":"https://github.com/deprecated-packages/SymfonyModularRouting","commit_stats":null,"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deprecated-packages%2FSymfonyModularRouting","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deprecated-packages%2FSymfonyModularRouting/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deprecated-packages%2FSymfonyModularRouting/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deprecated-packages%2FSymfonyModularRouting/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deprecated-packages","download_url":"https://codeload.github.com/deprecated-packages/SymfonyModularRouting/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248103868,"owners_count":21048245,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["modular","php","php71","routing","symfony","symfony32","symplify"],"created_at":"2024-09-24T20:02:53.317Z","updated_at":"2025-04-09T20:04:41.189Z","avatar_url":"https://github.com/deprecated-packages.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Modular Routing\n\n[![Build Status](https://img.shields.io/travis/Symplify/ModularRouting/master.svg?style=flat-square)](https://travis-ci.org/Symplify/ModularRouting)\n[![Downloads](https://img.shields.io/packagist/dt/symplify/modular-routing.svg?style=flat-square)](https://packagist.org/packages/symplify/modular-routing)\n\nTo add routes you usually need to add few lines to `app/config/routing.yml`. If you have over dozens of modules, it would be easy to get lost in it. To see all options on how to do that including this package, read [this short article](http://www.tomasvotruba.cz/blog/2016/02/25/modular-routing-in-symfony).\n\n\n**Thanks to this router, you can add them easily as via service loader**.\n\n\n## Install\n\n```bash\ncomposer require symplify/modular-routing\n```\n\nAdd bundle to `AppKernel.php`:\n\n```php\nfinal class AppKernel extends Kernel\n{\n    public function registerBundles(): array\n    {\n        $bundles = [\n            new Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle(),\n            new Symfony\\Cmf\\Bundle\\RoutingBundle\\CmfRoutingBundle(),\n            new Symplify\\ModularRouting\\SymplifyModularRoutingBundle(),\n            // ...\n        ];\n    }\n}\n```\n\n\n## Usage\n\n1. Implement [`RouteCollectionProviderInterface`](src/Contract/Routing/RouteCollectionProviderInterface.php)\n\n    ```php\n    use Symfony\\Component\\Routing\\Route;\n    use Symfony\\Component\\Routing\\RouteCollection;\n    use Symplify\\ModularRouting\\Contract\\Routing\\RouteCollectionProviderInterface;\n    \n    final class SomeRouteCollectionProvider implements RouteCollectionProviderInterface\n    {\n        public function getRouteCollection() : RouteCollection\n        {\n            $routeCollection = new RouteCollection();\n            $routeCollection-\u003eadd('my_route', new Route('/hello'));\n    \n            return $routeCollection;\n        }\n    }\n    ```\n\n2. Register service\n\n    ```yml\n    services:\n        some_module.route_provider:\n            class: SomeModule\\Routing\\SomeRouteCollectionProvider\n            autowire: true # or better use Symplify\\DefaultAutowire package\n    ```\n\nThat's all!\n\n\n### Loading YML/XML files\n\nIn case you want to load these files, just use [`AbstractRouteCollectionProvider`](src/Routing/AbstractRouteCollectionProvider.php)\nwith helper methods.\n\n```php\nuse Symfony\\Component\\Routing\\RouteCollection;\nuse Symplify\\ModularRouting\\Routing\\AbstractRouteCollectionProvider;\n\nfinal class FilesRouteCollectionProvider extends AbstractRouteCollectionProvider\n{\n    public function getRouteCollection(): RouteCollection\n    {\n        return $this-\u003eloadRouteCollectionFromFiles([\n            __DIR__ . '/routes.xml',\n            __DIR__ . '/routes.yml',\n        ]);\n        \n        // on in case you have only 1 file\n        // return $this-\u003eloadRouteCollectionFromFile(__DIR__ . '/routes.yml');\n    }\n}\n\n```\n\n\n## Contributing\n\nSend [issue](https://github.com/Symplify/Symplify/issues) or [pull-request](https://github.com/Symplify/Symplify/pulls) to main repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeprecated-packages%2Fsymfonymodularrouting","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeprecated-packages%2Fsymfonymodularrouting","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeprecated-packages%2Fsymfonymodularrouting/lists"}