Laravel-Jory: Flexible Eloquent API Resources
Concept Overview
Laravel Jory creates a dynamic API for your Laravel application to serve the data from your Eloquent models. JoryResources are comparable to Laravel's built-in Resource classes but you only write (or generate) a JoryResource once for each model. Next, your data can be queried in a flexible way by passing a Jory Query to the Jory Endpoints.
Jory is designed to be simple enough to master within minutes but flexible enough to fit 95% of your data-fetching use-cases. It brings Eloquent Query Builder's most-used features directly to your frontend.
Supported Functions
Querying
- Selecting fields (database fields & custom attributes)
-
Filtering (including nested
and
andor
clauses and custom filters) - Sorting (including custom sorts)
- Relations
- Offset & Limit
Endpoints
- Fetch a single record (like Laravel's
first()
) - Fetch a single record by id (like Laravel's
find()
) - Fetch multiple records (like Laravel's
get()
) - Fetch multiple resources at once
Aggregates
Metadata
- Total records (for pagination)
- Query count
For more information take a look at the docs.
Happy coding!
Jos Kolenberg jos@kolenbergsoftwareontwikkeling.nl