sehrgut / eloquery
Apply query parameters (filter, sort, paginate, eager-load) to a laravel eloquent query builder
Installs: 2 681
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 3
Forks: 1
Open Issues: 2
Requires
- php: >=7.2
- illuminate/database: ~5.2|^6.0|^7.0
- illuminate/http: ~5.2|^6.0|^7.0
- illuminate/support: ~5.2|^6.0|^7.0
Requires (Dev)
- mockery/mockery: ^1.3
- orchestra/testbench: ~3.0
- phpunit/phpunit: ^8.5
README
Table of Contents
Usage
Example usage directly in Controller
use App\Models\Book; use Illuminate\Routing\Controller; use SehrGut\Eloquery\Facades\Eloquery; class BooksController extends Controller { /** * List all records of type `Book`. */ public function index() { $builder = Book::query(); Eloquery::apply($builder); return $builder->get(); } }
API Documentation
https://sehrgutesoftware.github.io/eloquery/api/v0.8.1/
Changelog
Please refer to CHANGELOG.md.
Todo
- Refactor: Throw custom exception when parameters are invalid / insufficient
- Implement "include" grammar & operation
- Refactor: Query param names should be customizable
- Document query params syntax/usage
Compatibility
Tested with PHP 7.2, 7.3 and 7.4
Testing
composer install
composer test
Generate API Docs
composer docs
Alternatives
License
This software is licensed under the MIT License. See LICENSE.txt for details.