Download the PHP package macropay-solutions/php-crufd-wizard without Composer

On this page you can find all versions of the php package macropay-solutions/php-crufd-wizard. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-crufd-wizard

php-crufd-wizard - RetrieveQL

Build Status Total Downloads Latest Stable Version License

Features: Freemium vs Pro High Level Comparison

Feature / Operation RetrieveQL Freemium (php-crufd-wizard) RetrieveQL Pro (php-rest-wizard)
Data Engine Support ✅ SQL Databases Only ✅ SQL + Elasticsearch (via SQL Driver)
Create Resource ✅ Standard Create ✅ Standard Create
Read / Get Resource ✅ Single retrieve with relations ✅ Single retrieve with relations
Update Resource ✅ Standard Update ✅ Update, Upsert, & Incrementing (++x.xx)
Delete Resource ✅ Standard Delete ✅ Standard Delete
Bulk Delete Resource ✅ Via list({filters})->delete()
List Resource ✅ Standard List ✅ Standard List
List Relation as Resource ✅ (e.g., GET /{resource}/{pk}/{relation}?)
Composite Primary Key ✅ Supported (e.g., 12_35) ✅ Supported (e.g., 12_35)
Default Filtering (=) Strict Match (Exact equality) Starts With (Prefix match by default)
Advanced Filters from, to equals, in, not in, from, to, contains, notContains, is null, is not null
Response Formats ✅ JSON ✅ JSON, JSONL (limit=-1), StreamedJsonResponse
Pagination ✅ LengthAware, Simple, Cursor ✅ All Free + limit=0 (Count only)
Sorting ✅ Multi-column sorting ✅ Multi-column & Aggregate Sorting
Relational Loading withRelations, withRelationsCount, withRelationsExistence ✅ All Free + with appends, with distinct relations
Relation Constraints has relations, doesn't have relations, has distinct relations
Custom Deep Relations HasManySelfThroughSelf, HasManyThrough2LinkTables, HasManyThrough3LinkTables, HasOneSelfThroughSelf, HasOneThrough2LinkTables, HasOneThrough3LinkTables
Aggregations ✅ Sums, Averages, Minimums, Maximums, Distinct column(s) fetching
Elasticsearch KPIs Real-time Aggregations on ES Indexes
Group By & Subtotals ✅ Group By, Sub-totals, Sub-averages, Sub-minimums, Sub-maximums
Group Constraints ✅ Count Distinct, Group Count, Havings (including relation counts)
DB Protection / Guardrails ✅ API Timeout blocks (MySQL/MariaDB), MVCC select count(*) slow query fix

The Freemium Advantage

With the free version, you can instantly pull resources, load their relationships, check if relationships exist, and paginate through large datasets.

The Pro Advantage

When your data logic gets complex, the paid version of RetrieveQL replaces hundreds of lines of Obvious sub-queries, aggregations, and groupings. It also includes built-in safeguards against API-triggered database blocking.

Url query language lib for RESTful CRUD (micro) services

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.

I. Install

II. Start using it

III. Crud routes

III.1. Create resource

III.2. Get resource

III.3. List filtered resource

III.4. Update resource (or create)

III.5. Delete resource

I. Install

composer require macropay-solutions/php-crufd-wizard

II. Start using it

Look at

\MacropaySolutions\CrufdWizard\Providers\CrufdProvider. Its logic is already in PHP Framework registerExplicitBindingsMap and config.

The configuration (config/crufd_wizard.php) is automatically published by Composer upon installation/update in php-framework. Make sure to call $app->configure('crufd_wizard'); in bootstrap/app.php.

Create a constant in your code

Use https://github.com/macropay-solutions/php-crufd-wizard-generator to generate the model, service and controller or extend:

Create a Controller that uses ResourceControllerTrait and call $this->init(); from its __construct.

Optionally if you don't want to expose some models as resources but, you want to expose them as relation on an exposed resource then define in your Base Controller or ResourceController:

`

Active Record Segregation of Properties: for model attributes(columns) autocomplete and to avoid clashes with the model properties or relations:

Active Record Segregation of Properties: for model relation autocomplete and to avoid clashes with the model properties and attributes(columns):

Add this new resource to the above map.

Register the crud routes in your application using:

OBS

Set $returnNullOnInvalidColumnAttributeAccess = false; in model if you want exception instead of null on accessing invalid model attributes or invalid relations (It also needs error_reporting = E_ALL in php ini file).

Set LIST_UN_HYDRATED_WHEN_POSSIBLE = true in model if you want to skip obvious hydration for list db query results; note that setting this to true will not append the primary_key_identifier on response. Also if you use casts or any logic that alters (conditionally or not) the attributes of the model, you should leave LIST_UN_HYDRATED_WHEN_POSSIBLE as false.

Set LIVE_MODE=false in your .env file for non prod environments.

Use Request::getFiltered macro to sanitize data retrieved from request

The above will throw Array to string conversion error for query: ?signature[]= The proper way of handling it before:

The new way of handling it:

III. Crud routes

see \MacropaySolutions\CrufdWizard\Models\BaseModel::COMPOSITE_PK_SEPARATOR

III.1 Create resource

POST /{resource}

headers:

  Authorization: Bearer ... // if needed. not coded in this lib

  Accept: application/json

  ContentType: application/json

body:

  {
     "column_name":"value",
     ...
  }

Json Response:

201:

{
    "column_name":"value",
    ...
}

400:

{
    "message": "The given data was invalid.", // or other message
    "errors": {
        "column_name1": [
            "The column name 1 field is required."
        ],
        "column_name_2": [
           "The column name 2 field is required."
        ],
        ...
     }
}

The above "errors" are optional and appear only for validation errors while "message" will always be present.

III.2 Get resource

GET /{resource}/{identifier}?withRelations[]=has_manyRelation&withRelations[]=has_oneRelation&withRelationsCount[]=has_manyRelation&withRelationsExistence[]=has_manyRelation

GET /{resource}/{identifier}/{relation}/{relatedIdentifier}?withRelations[]=has_manyRelation&withRelations[]=has_oneRelation&withRelationsCount[]=has_manyRelation&withRelationsExistence[]=has_manyRelation

headers:

  Authorization: Bearer ... // if needed. not coded in this lib

  Accept: application/json

Use POST LIST requests if the identifier contains sensitive data

Json Response:

200:

{
    "identifier":"value",
    "column_name":"value",
    ...
    "index_required_on_filtering": [
       "column_name_1",
       "column_name2"
    ],
    "has_oneRelation":{...},
    "has_manyRelation":[
        {
            "id": ...,
            "name": "...",
            "pivot": {
               "key1": 25,
               "key2": 5
            }
        }
    ],
    "has_manyRelation_count": 0,
    "has_manyRelation_exist": false
}

400:

{
    "message": ...
}

The identifier can be composed by multiple identifiers for pivot resources that have composite primary key. Example:/table1-table2-pivot/3_10

The relations will be retrieved as well when required. The relation keys CAN'T be used for filtering!!!

key CAN'T be used for filtering.

is optional and appears only on relations that are tied via a pivot.

III.3 List filtered resource

GET /{resource}?page=1&limit=10&column=2&sort[0][by]=updated_at&sort[0][dir]=ASC&withRelations[]=has_manyRelation&withRelations[]=has_oneRelation&withRelationsCount[]=has_manyRelation&withRelationsExistence[]=has_manyRelation&updated_at[from]=2026-05-25 00:00:00&updated_at[to]=2026-05-25 23:59:59

POST /{resource}/l/i/s/t

GET /{resource}/{identifier}/{relation}?... // available only in paid version

POST /{resource}/{identifier}/{relation}/l/i/s/t // available only in paid version

Advanced filters and aggregations are available only in the paid version

headers:

  Authorization: Bearer ... // if needed. not coded in this lib

  Accept: application/json

  Content-Type: application/json OR application/x-www-form-urlencoded // for POST

Body for POST:

{"page":"1","limit":"10","column":"2","sort":[{"by":"updated_at","dir":"ASC"}],"withRelations":["has_manyRelation","has_oneRelation"],"withRelationsCount":["has_manyRelation"],"withRelationsExistence":["has_manyRelation"]}

OR

page=1&limit=10&column=2&sort[0][by]=updated_at&sort[0][dir]=ASC&withRelations[]=has_manyRelation&withRelations[]=has_oneRelation&withRelationsCount[]=has_manyRelation&withRelationsExistence[]=has_manyRelation

Use POST requests if GET returns this error message: Request Header Or Cookie Too Large

or if the filters contain sensitive data

Json Response:

200:

{
    "index_required_on_filtering": [
       "column_name1",
       "column_name2"
    ],
    "current_page": 1, // not present when cursor is present in request 
    "data": [
        {
           "identifier":"value",
           "column_name":"value",
           ...,
          "has_oneRelation":{...},
          "has_manyRelation":[
              {
                  "id": ...,
                  "name": "...",
                  "pivot": {
                     "key1": 25,
                     "key2": 5
                  }
              }
          ],
          "has_manyRelation_count": 0,
          "has_manyRelation_exist": false
        }
    ],
    "from": 1, // not present when cursor is present in request
    "last_page": 1, // not present when cursor is present in request or when simplePaginate is true in controller or present in request
    "per_page": 10,
    "to": 1, // not present when cursor is present in request
    "total": 1, // not present when cursor is present in request or simplePaginate is true in controller or present in request
    "has_more_pages": bool,
    "cursor": "..." // present only when cursor is present in request
}

The reserved words / parameters that will be used as query params are:

    page,
    limit,
    simplePaginate
    cursor,
    sort,
    withRelations,
    withRelationsCount,
    withRelationsExistence,

Defaults:

page=1;
limit=15;
simplePaginate is false by default and only its presence is checked in request, not its value
cursor is not defined
sort[][dir]=DESC

Obs.

index_required_on_filtering key CAN'T be used for filtering.
use ?cursor= for cursor pagination and ?simplePaginate=1 for simplePaginate. Use none of them for length aware paginator.
if \MacropaySolutions\Kernel\Http\Middleware\ConvertEmptyStringsToNull::class is used use ?cursor=1 instead of emtpy string
sort works also on aggregated colums for relation count and existence 
withRelations which uses with function does not load morphable relations. BaseResourceService::addRelationsToExistingModel can be used for those or loadMorph.

III.4 Update resource (or create)

PUT /{resource}/{identifier}

PUT /{resource}/{identifier}/{relation}/{relatedIdentifier}

headers:

  Authorization: Bearer ... // if needed. not coded in this lib

  Accept: application/json

  ContentType: application/json

body:

  {
     "column_name":"value",
     ...
  }

Json Response:

200 | 201:

{
    // all resource's fields
}

400:

{
    "message": "The given data was invalid.", // or other message
    "errors": {
        "column_name": [
           "The column name field is invalid."
        ],
        ...
    }
}

The above "errors" are optional and appear only for validation errors while "message" will always be present.

The identifier can be composed by multiple identifiers for pivot resources that have composite primary key (and empty string primary key in their model). Example:/resources/3_10

Update is not available on some resources.

UpdateOrCreate is available on resources that have their model defined with incrementing = false ONLY if the request contains all the keys from the primary key (found also in function getPrimaryKeyFilter).

Update will validate only dirty columns, not all sent columns, meaning the update can be made with all columns of the resource instead of just the changed ones.

III.5 Delete resource

DELETE /{resource}/{identifier}

DELETE /{resource}/{identifier}/{relation}/{relatedIdentifier}

headers:

  Authorization: Bearer ... // if needed. not coded in this lib

Json Response:

204:

[]

400:

{
    "message": ...
}

Delete is not available by default.


All versions of php-crufd-wizard with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-json Version *
ext-pdo Version *
psr/log Version ^1.0 || ^2.0 || ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package macropay-solutions/php-crufd-wizard contains the following files

Loading the files please wait ...