{"id":15068632,"url":"https://github.com/jerowork/slim-route-attribute-provider","last_synced_at":"2025-06-26T02:37:20.352Z","repository":{"id":46292614,"uuid":"319396585","full_name":"jerowork/slim-route-attribute-provider","owner":"jerowork","description":"Define Slim routes by PHP8 attributes.","archived":false,"fork":false,"pushed_at":"2025-06-02T17:38:12.000Z","size":293,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-03T06:54:09.002Z","etag":null,"topics":["attributes","php8","router","slim"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"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/jerowork.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-12-07T17:38:13.000Z","updated_at":"2025-06-02T17:38:14.000Z","dependencies_parsed_at":"2024-10-13T04:40:46.689Z","dependency_job_id":"5d308b0c-bc6a-4372-8f7c-7051e19291ee","html_url":"https://github.com/jerowork/slim-route-attribute-provider","commit_stats":{"total_commits":27,"total_committers":3,"mean_commits":9.0,"dds":"0.11111111111111116","last_synced_commit":"d549efab9bfd3bd9a6f2485c17e148cb793a5074"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/jerowork/slim-route-attribute-provider","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jerowork%2Fslim-route-attribute-provider","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jerowork%2Fslim-route-attribute-provider/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jerowork%2Fslim-route-attribute-provider/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jerowork%2Fslim-route-attribute-provider/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jerowork","download_url":"https://codeload.github.com/jerowork/slim-route-attribute-provider/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jerowork%2Fslim-route-attribute-provider/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261987866,"owners_count":23240922,"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":["attributes","php8","router","slim"],"created_at":"2024-09-25T01:38:38.242Z","updated_at":"2025-06-26T02:37:20.330Z","avatar_url":"https://github.com/jerowork.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# slim-route-attribute-provider\n[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fjerowork%2Fslim-route-attribute-provider%2Fbadge%3Fref%3Dmain\u0026style=flat-square)](https://github.com/jerowork/slim-route-attribute-provider/actions)\n[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/jerowork/slim-route-attribute-provider.svg?style=flat-square)](https://scrutinizer-ci.com/g/jerowork/slim-route-attribute-provider/code-structure)\n[![Quality Score](https://img.shields.io/scrutinizer/g/jerowork/slim-route-attribute-provider.svg?style=flat-square)](https://scrutinizer-ci.com/g/jerowork/slim-route-attribute-provider)\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)\n[![Packagist Version](https://img.shields.io/packagist/v/jerowork/slim-route-attribute-provider.svg?style=flat-square\u0026include_prereleases)](https://packagist.org/packages/jerowork/slim-route-attribute-provider)\n[![PHP Version](https://img.shields.io/badge/php-%5E8.1+-8892BF.svg?style=flat-square)](http://www.php.net)\n\nDefine [Slim](https://www.slimframework.com) routes by PHP8 [attributes]((https://stitcher.io/blog/attributes-in-php-8)).\n\n## Installation\nInstall via [Composer](https://getcomposer.org):\n```bash\n$ composer require jerowork/slim-route-attribute-provider\n```\n\n## Configuration\nInstantiate `RouteAttributeConfigurator` somewhere close to the construction of your Slim application,\ne.g. in your front controller (or ideally register in your PSR-11 container).\n\nBasic configuration:\n```php\nuse Jerowork\\RouteAttributeProvider\\RouteAttributeConfigurator;\nuse Jerowork\\RouteAttributeProvider\\Slim\\SlimRouteAttributeProvider;\nuse Slim\\Factory\\AppFactory;\n\n// Setup a (fictive) PSR-11 container and create Slim application\n$container = new Container();\n$app       = AppFactory::createFromContainer($container);\n\n// ...\n\n// Setup route attribute configuration\n$routeConfigurator = new RouteAttributeConfigurator(\n    SlimRouteAttributeProvider::createFromApp($app)\n);\n\n$routeConfigurator\n    -\u003eaddDirectory(sprintf('%s/src/Infrastructure/Api/Http/Action', __DIR__))\n    -\u003econfigure();\n\n// ...\n\n// Run Slim application\n$app-\u003erun();\n```\n\nExtended configuration:\n\n```php\nuse Jerowork\\FileClassReflector\\FileFinder\\RegexIterator\\RegexIteratorFileFinder;\nuse Jerowork\\FileClassReflector\\NikicParser\\NikicParserClassReflectorFactory;\nuse Jerowork\\RouteAttributeProvider\\RouteAttributeConfigurator;\nuse Jerowork\\RouteAttributeProvider\\Slim\\SlimRouteAttributeProvider;\nuse PhpParser\\NodeTraverser;\nuse PhpParser\\ParserFactory;\n\n// ...\n\n// All parts of the configurator can be replaced with a custom implementation\n$routeConfigurator = new RouteAttributeConfigurator(\n    new SlimRouteAttributeProvider(\n        $app-\u003egetRouteCollector(),\n        $container\n    ),\n    new ClassReflectorRouteLoader(\n        new NikicParserClassReflectorFactory(\n            new RegexIteratorFileFinder(),\n            (new ParserFactory())-\u003ecreate(ParserFactory::PREFER_PHP7),\n            new NodeTraverser()\n        )\n    )\n);\n\n// Multiple directories can be defined\n$routeConfigurator\n    -\u003eaddDirectory(\n        sprintf('%s/src/Infrastructure/Api/Http/Action', __DIR__),\n        sprintf('%s/src/Other/Controller', __DIR__)\n    )\n    -\u003econfigure();\n\n// ...\n```\n\n## Usage\nSee [jerowork/route-attribute-provider](https://github.com/jerowork/route-attribute-provider#usage) for examples.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjerowork%2Fslim-route-attribute-provider","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjerowork%2Fslim-route-attribute-provider","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjerowork%2Fslim-route-attribute-provider/lists"}