jwohlfert23/laravel-api-query
| Install | |
|---|---|
composer require jwohlfert23/laravel-api-query |
|
| Latest Version: | v6.1.2 |
| PHP: | ^8.2 |
| Laravel: | 11 · 12 · 13 |
| Older releases: | 6 – 10 |
| License: | MIT |
| Last Updated: | Jul 1, 2026 |
| Links: | GitHub · Packagist |
Build Eloquent Queries from Request Query Params
Installation
composer require jwohlfert23/laravel-api-query
Usage
This package is implemented as a trait, which provides the buildFromRequest scope.
use Jwohlfert23\LaravelApiQuery\BuildQueryFromRequest;
class Post {
use BuildQueryFromRequest;
}
Post::buildFromRequest()->get();
?sort=-id,name
is the same as:
Post::orderByDesc('id')->orderBy('name');
?filter[name]=Bobby&filter[author.name][contains]=Bob
is the same as:
Post::where('name', 'Bobby')->whereHas('author', function($q) {
$q->where('name', 'like', '%Bob%');
});
Note: this package doesn't use "whereHas", but rather performs left joins internally. However, the results should be the same as the above code.
Filters default to using the "equal" operator. These are the operators available to use in filtering (contains is use above).
- eq (=)
- gt (>)
- gte (>=)
- lt (<)
- lte (<=)
- contains
?with=author,comments
is the same as
Post::with('author','comments');
Related Packages
A query builder for Laravel that parses the request and uses Eloquent ORM to que...
A GraphQL like interface to map a request to eloquent query with data transforma...
A boilerplate package for BREAD operations through REST API in Laravel
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| v6.1.2 | ^8.2 | ^11.0| | MIT | |
| v6.1.1- | ^8.2 | ^11.0| | MIT | |
| 6.1.0 | ^8.2 | ^11.0| | MIT | |
| 6.0.2 | ^8.2 | ^11.0| | MIT | |
| 6.0.1 | ^8.2 | ^11.0| | MIT | |
| 6.0.0 | ^8.2 | ^11.0| | MIT | |
| 5.1.0 | ^8.2 | ^11.0| | MIT | |
| 5.0.1 | ^8.2 | ^11.0| | MIT | |
| 5.0.0 | ^8.2 | ^11.0| | MIT | |
| 4.0.0 | ^8.2 | ^10.0| | MIT | |
| 3.0.2 | ^8.0 | ^8.0| | MIT | |
| 3.0.1 | ^8.0 | ^8.0| | MIT | |
| 3.0.0 | ^8.0 | ^8.0| | MIT | |
| 2.2.1 | ^8.0 | ^8.0| | MIT | |
| 2.2.0 | ^8.0 | ^8.0| | MIT | |
| 2.1.0 | >=7.3 | ^8.0| | MIT | |
| 2.0.2 | >=7.3 | ^8.0| | MIT | |
| 2.0.1 | >=7.3 | ^8.0| | MIT | |
| 2.0.0 | >=7.3 | ^8.0| | MIT | |
| 1.6.3 | >=5.5.9 | >=7.0 | MIT | |
| 1.6.2 | >=5.5.9 | >=7.0 | MIT | |
| 1.6.1 | >=5.5.9 | >=7.0 | MIT | |
| 1.6.0 | >=5.5.9 | >=7.0 | MIT | |
| 1.5.0 | >=5.5.9 | >=7.0 | MIT | |
| 1.4.6 | >=5.5.9 | >=6.0 | MIT | |
| 1.4.5 | >=5.5.9 | >=6.0 | MIT | |
| 1.4.4 | >=5.5.9 | >=6.0 | MIT | |
| 1.4.3 | >=5.5.9 | >=6.0 | MIT | |
| 1.4.2 | >=5.5.9 | >=6.0 | MIT | |
| 1.4.1 | >=5.5.9 | >=6.0 | MIT |
Showing the latest 30 of 44. See every release on Packagist