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

On this page you can find all versions of the php package macropay-solutions/php-crufd-wizard-decorator. 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-decorator

php-crufd-wizard-decorator - CrufdQL

Build Status Total Downloads Latest Stable Version License

This can be used for decorating php-crufd-wizard

Decorator High Level Comparison: Freemium vs Pro

The Decorator suite acts as the presentation layer for your microservices, bridging the gap between your internal database structure and your public API contract.

Feature Decorator Freemium (php-crufd-wizard-decorator) Decorator Pro (php-rest-wizard-decorator)
Schema Masking ✅ Rename/Map resource & relation columns ✅ Rename/Map resource & relation columns
Relation Wrapping ✅ Decorate attributes of loaded relations ✅ Decorate attributes of loaded relations
Data Flattening ✅ Single Table Flattening (Merge resource + relations into one flat response) ✅ Single Table Flattening (Merge resource + relations into one flat response)
Virtual Columns ❌ ✅ Composed Columns (Create new fields from multiple resource/relation columns)
Memory-Safe Export ❌ ✅ Streamed CSV Download (Direct to client; no file saved on server)
Filter Transformation ❌ ✅ Query Rewriting (Map resource columns to relation filters via URL query string)
Response Control ✅ Standard JSON decoration ✅ Restricted Columns (Return only requested keys, including in CSV streams)
Relational Updates ❌ ✅ One-to-One Update (Update related models during resource update)
Aggregations ❌ ✅ Resource & Relation Aggregations (Sums, Avgs, etc. on children) from php-rest-wizard
Security (XSS) ✅ Auto-Sanitization (All JSON string values parsed by htmlspecialchars) ✅ Auto-Sanitization (All JSON string values parsed by htmlspecialchars)

Key Advantages of the Pro Decorator Suite

Zero-Footprint CSV Streaming

The Pro decorator can stream millions of rows directly to the client's browser without ever saving a temporary file on the server. This bypasses PHP memory_limit crashes and eliminates "Disk Full" errors during large exports.

Composed & Flattened Data

Build high-performance frontend tables with ease. Pro allows you to merge data from multiple relations and compose new virtual columns (e.g., calculating margin from cost and price fields across different tables) on the fly.

Relation Filter Transformation

Eases the complexity of URL queries. Users can filter by a "public" mapped column name, and the engine automatically transforms it into the correct internal relational logic (joins/where clauses) behind the scenes.

Atomic One-to-One Updates

Maintain data integrity without extra controller boilerplate. When you update a main resource, the Pro decorator handles the simultaneous update of any associated one-to-one relations in a single, clean operation.

AI Integration Note

If you are using the PHP Framework .cursorrules configuration, use the {--decorated} flag with the generator:

It renames/maps the column names for the resource and its relations.

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

The query params will be disregarded

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-decorator

II. Start using it

OBS.

Use the middleware in your crud route definition for each method if you have only few routes (it is faster to use the middleware FQN directly in the route definition):

In this way you avoid loading on each request the route middleware array that in some cases can become quite big (hundreds of elements).

Coupled with cached routes this solution is faster than the initial one.

Example:

III. Crud routes

III.1 Create resource

POST /{resource}

headers:

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

  Accept: application/json

  ContentType: application/json

body:

  {
     "roleID": "1",
  }

Json Response:

200:

{
    "success": true,
    "code": 201,
    "locale": "en",
    "message": "success",
    "data": {
        "ID": 3,
        "roleID": "1",
        "updatedAt": "2022-10-27 09:05:49",
        "createdAt": "2022-10-27 09:04:46",
        "pki": "3"
    }
}

{
    "success": false,
    "code": 400,
    "locale": "en",
    "message": "The given data was invalid: The role id field is required.",
    "data": {
        "roleID": [
            "The role id field is required."
        ]
    }
}

III.2 Get resource

GET /{resource}/{identifier}

GET /{resource}/{identifier}/{relation}/{relatedIdentifier}

headers:

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

  Accept: application/json

Json Response:

200:

{
    "success": true,
    "code": 200,
    "locale": "en",
    "message": "success",
    "data": {
        "ID": 3,
        "roleID": "1",
        "updatedAt": "2022-10-27 09:05:49",
        "createdAt": "2022-10-27 09:04:46",
        "roleRelationName": "name",
        "roleRelationColor": "blue",
        "pki": "3"
    }
}

{
    "success": false,
    "code": 400,
    "locale": "en",
    "message": "Not found",
    "data": null
}

III.3 List filtered resource

GET /{resource}?perPage=10&page=2

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

headers:

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

  Accept: application/json or application/xls

The xls will contain undecorated columns and needs special access. See AbstractDecoratorMiddleware::isUserAllowedToDownloadXls

Json Response:

200:

{
    "success": true,
    "code": 200,
    "locale": "en",
    "message": "success",
    "data": {
        "current_page": 1,
        "data": [
            {
                "ID": 3,
                "roleID": "1",
                "updatedAt": "2022-10-27 09:05:49",
                "createdAt": "2022-10-27 09:04:46",
                "roleRelationName": "name",
                "roleRelationColor": "blue",
                "pki": "3"
            }
        ],
        "from": 1,
        "last_page": 1,
        "per_page": 10,
        "to": 1,
        "total": 1,
        "filterable": [
            "ID",
            "roleID",
            "updatedAt",
            "createdAt",
        ],
        "sortable": [
            "ID",
            "roleID"
        ]
    }
}

Binary response for application/xls

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:

  {
    "roleID": "2"
  }

Json Response:

200:

{
    "success": true,
    "code": 200, // or 201 for upsert
    "locale": "en",
    "message": "success",
    "data": {
        "ID": 3,
        "roleID": "2",
        "updatedAt": "2022-10-27 09:05:49",
        "createdAt": "2022-10-27 09:04:46",
        "pki": "3"
    }
}

{
    "success": false,
    "code": 400,
    "locale": "en",
    "message": "The given data was invalid: The role id field is required.",
    "data": {
        "roleID": [
            "The role id field is required."
        ]
    }
}

In case of validation errors, only the keys from data object will be decorated!

III.5 Delete resource

DELETE /{resource}/{identifier}

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

headers:

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

  Accept: application/json

Json Response:

200:

{
    "success": true,
    "code": 204,
    "locale": "en",
    "message": "success",
    "data": null
}

{
    "success": false,
    "code": 400,
    "locale": "en",
    "message": "Not found",
    "data": null
}

All versions of php-crufd-wizard-decorator with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-json Version *
macropay-solutions/php-crufd-wizard Version ^1.0.0
macropay-solutions/php-kernel Version ^1.0.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-decorator contains the following files

Loading the files please wait ...