Download the PHP package mkd/laravel-fast-api without Composer
On this page you can find all versions of the php package mkd/laravel-fast-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mkd/laravel-fast-api
More information about mkd/laravel-fast-api
Files in mkd/laravel-fast-api
Package laravel-fast-api
Short Description Laravel FastAPI is a 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 improves code organization and enhances performance with route caching. Perfect for developers looking to build clean, efficient APIs in Laravel.
License MIT
Homepage https://github.com/mustafakhaleddev/laravel-fast-api
Informations about the package laravel-fast-api
Laravel Fast-API
Laravel 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.
This package also integrates seamlessly with Laravel's route:cache
for enhanced performance, ensuring your APIs are as fast as possible.
Features
- Attribute-Based Routing: Define your API routes using PHP attributes.
- Support for Advanced Routing Options: Middleware, where clauses, route options, and more!
- Enum-Based HTTP Methods: Use the predefined
FastApiMethod
for your HTTP methods. - API Caching: Leverage Laravel's
route:cache
for optimal performance. - Clear API Cache: Quickly clear cached API routes with simple Artisan commands.
Installation
You can install the package via Composer:
Usage
Define FastAPI Routes
Use the #[FastAPIGroup]
and #[FastAPI]
attributes to define routes inside your controller classes.
This simple attribute-based approach automatically handles routing logic, allowing you to focus on building your API logic.
Supported Methods and Functions
You can define routes with the following HTTP methods:
In addition, you can leverage these functions to customize your routes:
Configurations
In your configuration file, you can specify paths and controllers to be scanned for FastAPI attributes.
Artisan Commands
FastAPI provides useful commands for caching and clearing controllers:
-
Cache the controllers for better scanning performance:
- Clear the cached controllers:
Performance
By 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.
Contributing
Feel free to submit issues and pull requests. Contributions are welcome!
License
The MIT License (MIT). Please see License File for more information.