{"id":17492382,"url":"https://github.com/mustafakhaleddev/laravel-fast-api","last_synced_at":"2026-01-30T01:09:27.981Z","repository":{"id":257895660,"uuid":"873830661","full_name":"mustafakhaleddev/laravel-fast-api","owner":"mustafakhaleddev","description":"Laravel PHP attribute-based routing package designed to streamline API development. It enables developers to define routes, methods, and middlewares directly within their controllers using simple PHP attributes. By reducing the complexity of traditional route definition, Laravel FastAPI","archived":false,"fork":false,"pushed_at":"2024-10-16T19:50:32.000Z","size":9,"stargazers_count":11,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-21T18:15:15.576Z","etag":null,"topics":["api","fastapi","laravel","laravel-framework","laravel-package"],"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/mustafakhaleddev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","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}},"created_at":"2024-10-16T19:43:19.000Z","updated_at":"2025-05-31T05:47:27.000Z","dependencies_parsed_at":"2024-10-16T23:07:34.648Z","dependency_job_id":null,"html_url":"https://github.com/mustafakhaleddev/laravel-fast-api","commit_stats":null,"previous_names":["mustafakhaleddev/laravel-fast-api"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mustafakhaleddev/laravel-fast-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mustafakhaleddev%2Flaravel-fast-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mustafakhaleddev%2Flaravel-fast-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mustafakhaleddev%2Flaravel-fast-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mustafakhaleddev%2Flaravel-fast-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mustafakhaleddev","download_url":"https://codeload.github.com/mustafakhaleddev/laravel-fast-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mustafakhaleddev%2Flaravel-fast-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28892890,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-29T21:06:44.224Z","status":"ssl_error","status_checked_at":"2026-01-29T21:06:42.160Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["api","fastapi","laravel","laravel-framework","laravel-package"],"created_at":"2024-10-19T09:04:11.329Z","updated_at":"2026-01-30T01:09:27.964Z","avatar_url":"https://github.com/mustafakhaleddev.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel Fast-API\n\n[![Latest Version](https://img.shields.io/github/v/release/mustafakhaleddev/laravel-fast-api.svg?style=flat-square)](https://github.com/mustafakhaleddev/laravel-fast-api/releases)\n[![Issues](https://img.shields.io/github/issues/mustafakhaleddev/laravel-fast-api.svg?style=flat-square)](https://github.com/mustafakhaleddev/laravel-fast-api/issues)\n[![License](https://img.shields.io/github/license/mustafakhaleddev/laravel-fast-api.svg?style=flat-square)](https://github.com/mustafakhaleddev/laravel-fast-api/blob/main/LICENSE)\n\nLaravel FastAPI is a PHP attribute-based routing solution for building APIs quickly and efficiently. With FastAPI attributes, you can define routes, methods, and middlewares directly in your controller classes, reducing the need for complex route files and enabling better organization and clarity.\n\nThis package also integrates seamlessly with Laravel's `route:cache` for enhanced performance, ensuring your APIs are as fast as possible.\n\n## Features\n\n- **Attribute-Based Routing**: Define your API routes using PHP attributes.\n- **Support for Advanced Routing Options**: Middleware, where clauses, route options, and more!\n- **Enum-Based HTTP Methods**: Use the predefined `FastApiMethod` for your HTTP methods.\n- **API Caching**: Leverage Laravel's `route:cache` for optimal performance.\n- **Clear API Cache**: Quickly clear cached API routes with simple Artisan commands.\n\n## Installation\n\nYou can install the package via Composer:\n\n```bash\ncomposer require mkd/laravel-fast-api\n```\n\n## Usage\n\n### Define FastAPI Routes\n\nUse the `#[FastAPIGroup]` and `#[FastAPI]` attributes to define routes inside your controller classes.\n\n```php\nuse MKD\\FastAPI\\Attributes\\FastAPI;\nuse MKD\\FastAPI\\Attributes\\FastAPIGroup;\n\n#[FastAPIGroup(prefix: '/items', options: ['name' =\u003e 'items'], middlewares: ['auth'])]\nclass ItemsController extends Controller\n{\n    #[FastAPI(method: FastApiMethod::GET, path: '/data/{id}', options: ['functions' =\u003e [\n        'whereIn' =\u003e ['id', ['2']],\n    ], 'name' =\u003e 'item_id'])]\n    public function getItem($id)\n    {\n        return response()-\u003ejson(['item' =\u003e $id]);\n    }\n}\n```\n\nThis simple attribute-based approach automatically handles routing logic, allowing you to focus on building your API logic.\n\n### Supported Methods and Functions\n\nYou can define routes with the following HTTP methods:\n\n```php\nenum FastApiMethod\n{\n    case GET;\n    case POST;\n    case PUT;\n    case PATCH;\n    case OPTION;\n    case DELETE;\n    case ANY;\n    case REDIRECT;\n    case MATCH;\n}\n```\n\nIn addition, you can leverage these functions to customize your routes:\n\n```php\nprivate array $supportedFunctions = [\n    'middleware',\n    'where',\n    'whereNumber',\n    'whereAlpha',\n    'whereAlphaNumeric',\n    'whereUuid',\n    'whereUlid',\n    'whereIn',\n    'name',\n    'withTrashed',\n    'scopeBindings',\n    'withoutScopedBindings',\n];\n```\n\n### Configurations\n\nIn your configuration file, you can specify paths and controllers to be scanned for FastAPI attributes.\n\n```php\nreturn [\n    //Paths to check for controllers that use fast-api\n    'paths' =\u003e [\n        app_path('Http/Controllers'),\n    ],\n\n    //Specify controllers that are not included in the paths\n    'controllers' =\u003e [\n        \\App\\Http\\Controllers\\CustomController::class\n    ],\n];\n```\n\n### Artisan Commands\n\nFastAPI provides useful commands for caching and clearing controllers:\n\n- Cache the controllers for better scanning performance:\n\n  ```bash\n  php artisan fast-api:cache\n  ```\n\n- Clear the cached controllers:\n\n  ```bash\n  php artisan fast-api:clear-cache\n  ```\n\n### Performance\n\nBy using Laravel's `route:cache`, the FastAPI routes are cached to ensure high performance. It is recommended to always cache your routes in production environments for faster API responses.\n\n```bash\nphp artisan route:cache\n```\n\n## Contributing\n\nFeel free to submit issues and pull requests. Contributions are welcome!\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE) for more information.\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmustafakhaleddev%2Flaravel-fast-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmustafakhaleddev%2Flaravel-fast-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmustafakhaleddev%2Flaravel-fast-api/lists"}