PHPackages                             macropay-solutions/laravel-crud-wizard-decorator-free - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Admin Panels](/categories/admin)
4. /
5. macropay-solutions/laravel-crud-wizard-decorator-free

ActiveLibrary[Admin Panels](/categories/admin)

macropay-solutions/laravel-crud-wizard-decorator-free
=====================================================

Data composition/decoration for laravel-crud-wizard-free library including url query language

2.0.3(2mo ago)34611MITPHPPHP ^8.0CI passing

Since Mar 26Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/macropay-solutions/laravel-crud-wizard-decorator-free)[ Packagist](https://packagist.org/packages/macropay-solutions/laravel-crud-wizard-decorator-free)[ RSS](/packages/macropay-solutions-laravel-crud-wizard-decorator-free/feed)WikiDiscussions production Synced 1mo ago

READMEChangelog (10)Dependencies (20)Versions (20)Used By (1)

laravel-crud-wizard-decorator-free - MaravelQL
==============================================

[](#laravel-crud-wizard-decorator-free---maravelql)

[![1_9gPPofZEi8eKSFMrEMIF5w7](https://private-user-images.githubusercontent.com/153634237/562818279-9b6619b5-0b9d-4a57-9014-53d7c2fc0640.webp?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzU0NjI4NDQsIm5iZiI6MTc3NTQ2MjU0NCwicGF0aCI6Ii8xNTM2MzQyMzcvNTYyODE4Mjc5LTliNjYxOWI1LTBiOWQtNGE1Ny05MDE0LTUzZDdjMmZjMDY0MC53ZWJwP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MDQwNiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjA0MDZUMDgwMjI0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ODI3M2FmZDIzNTQ2NjU2YTcwMGE1NTk4NTJmYjRlNjRlYjQzYTZhOGY3ZWFkNWMyYmU3MWY1ZGI1OWU4ZTdkZiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.NgzZgfpNYw55WiJzKJrzxcdmK9LzuePaPInxw_f1UEM)](https://private-user-images.githubusercontent.com/153634237/562818279-9b6619b5-0b9d-4a57-9014-53d7c2fc0640.webp?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzU0NjI4NDQsIm5iZiI6MTc3NTQ2MjU0NCwicGF0aCI6Ii8xNTM2MzQyMzcvNTYyODE4Mjc5LTliNjYxOWI1LTBiOWQtNGE1Ny05MDE0LTUzZDdjMmZjMDY0MC53ZWJwP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MDQwNiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjA0MDZUMDgwMjI0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ODI3M2FmZDIzNTQ2NjU2YTcwMGE1NTk4NTJmYjRlNjRlYjQzYTZhOGY3ZWFkNWMyYmU3MWY1ZGI1OWU4ZTdkZiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.NgzZgfpNYw55WiJzKJrzxcdmK9LzuePaPInxw_f1UEM)

[![Build Status](https://github.com/macropay-solutions/laravel-crud-wizard-decorator-free/actions/workflows/tests.yml/badge.svg)](https://github.com/macropay-solutions/laravel-crud-wizard-decorator-free/actions)[![Total Downloads](https://camo.githubusercontent.com/470ec694082eae517b79f3392ab9c3518855ab9c17acd296e92671d6e521aaf2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6163726f7061792d736f6c7574696f6e732f6c61726176656c2d637275642d77697a6172642d6465636f7261746f722d66726565)](https://packagist.org/packages/macropay-solutions/laravel-crud-wizard-decorator-free)[![Latest Stable Version](https://camo.githubusercontent.com/04a17a2000ff2cb101a8040039a1601152976246ee73f4ff9b5b1b63b6d5a829/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6163726f7061792d736f6c7574696f6e732f6c61726176656c2d637275642d77697a6172642d6465636f7261746f722d66726565)](https://packagist.org/packages/macropay-solutions/laravel-crud-wizard-decorator-free)[![License](https://camo.githubusercontent.com/2201e2d448ab8ab4fc1bb0b15acd6032b63c52413910d8367508cf4ed9dd4500/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d6163726f7061792d736f6c7574696f6e732f6c61726176656c2d637275642d77697a6172642d6465636f7261746f722d66726565)](https://packagist.org/packages/macropay-solutions/laravel-crud-wizard-decorator-free)

This is a stripped down version of [maravel-rest-wizard-decorator](https://github.com/macropay-solutions/laravel-lumen-crud-wizard-decorator)

and can be used for decorating [laravel-crud-wizard-free](https://github.com/macropay-solutions/laravel-crud-wizard-free)

Decorator High Level Comparison: Freemium vs Pro
------------------------------------------------

[](#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.

FeatureDecorator Freemium (`laravel-crud-wizard-decorator-free`)Decorator Pro (`maravel-rest-wizard-decorator`)**Schema Masking**✅ Rename/Map resource &amp; relation columns✅ Rename/Map resource &amp; 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 &amp; Relation Aggregations** (Sums, Avgs, etc. on children) from maravel-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

[](#key-advantages-of-the-pro-decorator-suite)

#### Zero-Footprint CSV Streaming

[](#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 &amp; Flattened Data

[](#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

[](#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

[](#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

[](#ai-integration-note)

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

```
php artisan make:api-resource {resourceName} --decorated
```

[Demo page](https://laravel-crud-wizard.com/laravel-12-free/laravel-lumen-crud-wizard/decorated)

[Demo integration](https://github.com/macropay-solutions/laravel-crud-wizard-decorator-free-demo/commits/production/)

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

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

- perPage
- page

The `withRelations, withRelationsCount, withRelationsExistence` query params will be disregarded

I. [Install](#i-install)

II. [Start using it](#ii-start-using-it)

III. [Crud routes](#iii-crud-routes)

III.1. [Create resource](#iii1-create-resource)

III.2. [Get resource](#iii2-get-resource)

III.3. [List filtered resource](#iii3-list-filtered-resource)

III.4. [Update resource (or create)](#iii4-update-resource-or-create)

III.5. [Delete resource](#iii5-delete-resource)

I. Install
----------

[](#i-install)

```
composer require macropay-solutions/laravel-crud-wizard-decorator-free

```

II. Start using it
------------------

[](#ii-start-using-it)

Register your middleware decorators as route middleware for each resource:

```
    $app->routeMiddleware([
        'decorate-' . \MacropaySolutions\LaravelCrudWizardDecorator\Models\ExampleModel::resourceName()=>
            MacropaySolutions\LaravelCrudWizardDecorator\Http\Middleware\Decorators\ExampleMiddleware::class,
    ]);
```

OBS.

- The `withRelations, withRelationsCount, withRelationsExistence` query params will be disregarded. These are to be used only internally with undecorated request.
- 202 http response code will not be decorated, and it can be used to send messaged to FE. Example: {"message":"Accepted"}
- 204 http response will be decorated as empty body.

Use the middleware alias as middleware in your crud route definition for each method if you have only few routes:

```
    'decorate-' . $resourceName . ':list'
    'decorate-' . $resourceName . ':get'
    'decorate-' . $resourceName . ':getRelated'
    'decorate-' . $resourceName . ':update'
    'decorate-' . $resourceName . ':updateRelated'
    'decorate-' . $resourceName . ':create'
    'decorate-' . $resourceName . ':delete'
    'decorate-' . $resourceName . ':deleteRelated'
```

If you have many routes that need decoration, it is faster to use the middleware FQN directly in the route definition:

```
    SomeMiddleware::class . ':list'
    ...
```

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 ([Maravel supports route caching as opposed](https://github.com/macropay-solutions/maravel/wiki) to Lumen) this solution is faster than the initial one I suggested.

Example:

```
