/laravel-lumen-crud-wizard

Build RESTful services without codding the filters manually

laravel-lumen-crud-wizard

laravel-lumen-crud-wizard-logo

Url query language lib for RESTful CRUD (micro) services using lumen/laravel 8-9-10-11

This is not just another CRUD lib!

It has built in filtering capabilities that can be used for listing but also for mass deleting, so it could be called a CRUFD (create, read, update, filter and delete) lib instead.

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.

Long story short: so you don't have to code the filters by hand.

For free version see Laravel Crud Wizard Free

See also Laravel Lumen Crud Wizard Decorator.

I. You get

II. Features

II.1. Create resource

II.2. Read / Get resource

II.3. Update / Upsert / Increment resource

II.4. Delete resource

II.5. Bulk delete resource

II.6. List resource

II.7. Composite primary key

II.8. Sql debugging/logging

II.9. Error handling/logging

II.10. Datetime NOT timestamp for created_at and updated_at columns

II.11. Autocomplete on model properties

III. Usage

IV. Try it

I. You get:

  • crud-wizard-builder: request builder that is used to encode the request in the request initiator project + documentation (min PHP 7.4 or 8.0)
  • laravel-crud-wizard: request parser or translator into sql for the request target project + documentation (min PHP 8.0)
  • laravel 9 demo project that uses laravel-crud-wizard

The code follows PSR 12 coding standard and DRY principle.

Can be used with laravel/lumen 8-9-10-11 and sql databases (tested on mysql/mariadb but can also support sqlite, sqlsrv, pgsql).

Can be used to generate sql for Elasticsearch.

The lib is proprietary and can be used only after an agreement.

On request we can issue a test token to be used on a laravel 9 DEMO project that has a dummy db. The url query language can be tested/tried without a token (only for filtering) in our demo page.

If interested, please contact us.

II. Features:

II.1. Create resource

  • only with allowed fields

II.2. Read/Get resource

  • also with relations, appends, count relations and exist relations

II.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.

II.4. Delete resource

  • only if allowed

II.5. Bulk delete resource

  • only if codded using $service->list({Controlled filters})->delete();
  • not built-in

II.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

  • aggregations

    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),

  • 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 codding)

    with distinct (columns from) relations,

    has relations,

    has distinct relations,

    doesn't have relations,

    relations filters,

  • 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

II.7. Composite primary key

  • using user defined separator (default _): 12_35

II.8. Sql debugging/logging

II.9. Error handling/logging

II.10. Datetime NOT timestamp for created_at and updated_at columns

II.11. Autocomplete on model properties

image

image

image

Also if autocomplete is needed on the model itself, them @ mixin can be added on the model:

image

image

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.

image

III. Usage:

Changes required for the first resource on laravel 9 for example: image With green are the changes needed for a new resource (except ResourceController).

See laravel 9 demo project that uses laravel-crud-wizard

IV. Try it:

Postman collection. Please contact us for a bearer token.

The lib filtering capabilities (url query language) can be tested WITHOUT bearer token on laravel 9 demo page or laravel 10 demo page

image

image

image

Use our demo UI url query builder:

image

Note that the demo db has over 3.7 million operations.