This is not just another CRUD lib!
Key Features
Build RESTful services with lightning speed for any number of resources and relations using rest crud library that offers revolutionary filtering (and aggregating) capabilities for resources and their relations.
With an average speed of 15 minutes per table you can expose your database via API with built-in auto filters and aggregations faster than ever.
1. Create resource
- only with allowed fields
2. Read/Get resource
- also with relations, appends, count relations and exist relations
3. Update/Upsert/Increment resource
- only with allowed fields (or create if not found, if (pk) incrementing = false or by custom condition if the identifier is other than the pk)
- also with relations, appends, count relations and exist relations
- supports incrementing for the summable columns ONLY. Use "++x[.xx]" or "--x[.xx]". Incrementing can be made together with other updates. Incrementing is possible only on existing resource.
4. Delete resource
- only if allowed
5. Bulk delete resource
- only if coded using $service->list({Controlled filters})->delete();
- not built-in
6. List resource
- list resource /resource?...
- list the resource's relation (as a resource) /resource/{pk}/{relationName}?...
- list response as JSON or XLS (with relations in different sheets) controlled via request header
Accept application/xls or application/json - multi sorting on the resource's columns and on its aggregations and default sort
- in header query for GET requests or POST requests for filtering with sensitive data
- to avoid 499 http code in access logs and DB block via api call, the DB select statements are restricted with a timeout for mysql >= 5.7.4 and mariadb >= 10.1.1
- aggregations (including on the FILTERED relations' columns) sums, averages, minimums, maximums, distinct column(s) fetching (including custom sql: 'distinct COALESCE(NULLIF(
{table}.column, ""),{table}.column2) as column)', group by (columns of the resource plus relation counts and date cast able columns, but if index required on filtering is enabled then first group by column MUST be indexed and not casted; if distincts are used then group by is disregarded), sub totals, sub averages, sub minimums, sub maximums, count distinct, group count, count relations, exist relations, havings (including relation counts, group counts, count distincts, sums, averages, minimums, maximums), - filters for resource and relations: from (inclusive), to (inclusive), in, not in, starts with, is null (inluding also (column in (...) OR column IS NULL) condition), is not null, contains (not fulltext search), notContains,
- pagination (LengthAwarePaginator as default or Paginator or CursorPaginator) page, limit, // limit=0 for count only without pages simplePaginate (request response without total count) cursor
- conditions on relations with/without relations, with appends, (need custom coding) with distinct (columns from) relations, has relations, has distinct relations, doesn't have relations, relations OPTIMIZED filters (except morph relations),
- custom NEW relations HasManySelfThroughSelf, HasManyThrough2LinkTables, HasManyThrough3LinkTables, HasOneSelfThroughSelf, HasOneThrough2LinkTables, HasOneThrough3LinkTables,
- MVCC DB "select count(*) from table" slow query solution in MySql >= 8 In worst case scenario will estimate the count rather than execute the count without index filter
- prevent DB blocking via API with long running queries for mysql >= 5.7.4 and mariaDB >= 10.1.1
- retroactive working StreamedJsonResponse laravel/framework#55509
7. Composite primary key
- using user defined separator (default _): 12_35
8. Sql debugging/logging
9. Error handling/logging
10. Datetime NOT timestamp for created_at and updated_at columns
11. Autocomplete on model properties
- Also if autocomplete is needed on the model itself, then @ mixin can be added on the model.
- Putting @ property on the model is less effective as opposed to this new Attribute class because of the public properties from eloquent model. Also it will avoid polluting the autocomplete with functions and properties from Eloquent model.