sehrgut/eloquery

This package is abandoned and no longer maintained. No replacement package was suggested.

Apply query parameters (filter, sort, paginate, eager-load) to a laravel eloquent query builder

v0.9.0 2020-05-27 10:10 UTC

README

Build Status Test Coverage Maintainability Latest Stable Version

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.