laravel-api-optimizer maintained by sakshsky
Laravel API Resource Optimizer
Laravel API Resource Optimizer enhances Laravel's API Resource classes with advanced optimization features like sparse fieldsets, conditional relationship loading, and response caching, making your REST APIs faster and more flexible.
Features
- Sparse Fieldsets: Request specific fields (e.g.,
GET /users?fields=id,name). - Conditional Relationship Loading: Include related data (e.g.,
GET /users?include=posts). - Response Caching: Cache API responses to reduce database queries.
- Schema Validation: Validate requested fields and includes.
- Rate-Limiting: Protect endpoints with throttling.
Requirements
- PHP 8.0 or higher
- Laravel 8.x, 9.x, or 10.x
- Composer
Installation
Install via Composer:
composer require sakshsky/laravel-api-optimizer