PHPackages                             crixuamg/laravel-decorators - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. crixuamg/laravel-decorators

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

crixuamg/laravel-decorators
===========================

8.3.0(2y ago)28.2k↓33.3%MITPHPPHP \*CI failing

Since Feb 23Pushed 2y ago1 watchersCompare

[ Source](https://github.com/CrixuAMG/laravel-decorators)[ Packagist](https://packagist.org/packages/crixuamg/laravel-decorators)[ RSS](/packages/crixuamg-laravel-decorators/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (15)Versions (165)Used By (0)

laravel-decorators
==================

[](#laravel-decorators)

[![Latest Stable Version](https://camo.githubusercontent.com/7b7c27a401cacd42045c95bcf59829a85ee4574822c7f7f1633399ca5a67b42d/68747470733a2f2f706f7365722e707567782e6f72672f6372697875616d672f6c61726176656c2d6465636f7261746f72732f762f737461626c65)](https://packagist.org/packages/crixuamg/laravel-decorators)[![Latest Unstable Version](https://camo.githubusercontent.com/3b0f1a5817bea7ffe4180cdf742adaf4107b99801891655e279112348d0fbfd5/68747470733a2f2f706f7365722e707567782e6f72672f6372697875616d672f6c61726176656c2d6465636f7261746f72732f762f756e737461626c65)](https://packagist.org/packages/crixuamg/laravel-decorators)[![Total Downloads](https://camo.githubusercontent.com/cf489bed31879710fbb25c765c4e763fb311cbc1ccc4cf8194041da30f473867/68747470733a2f2f706f7365722e707567782e6f72672f6372697875616d672f6c61726176656c2d6465636f7261746f72732f646f776e6c6f616473)](https://packagist.org/packages/crixuamg/laravel-decorators)

[About](#about)
[Installation](#installation)
[Usage](#about)
[Customization](#customization)
[Commands](#commands)

Installation
------------

[](#installation)

Put the following in your composer.json file:

```
    "require": {
        "crixuamg/laravel-decorators": "^6.0.0",
        // ...
    }
```

Usage
-----

[](#usage)

After publishing the config file, register your decorators as shown in the bottom of the file. Then extend the AbstractController in a controller and call `$this->setup()` in the `__construct()` using the key created in the config file.

```
Example:\
UserController

```php
use \CrixuAMG\Decorators\Http\Controllers\AbstractController;

class UserController extends AbstractController {
    public function __construct()
    {
        $this->setup('users', UserResource::class);
    }

    public function index() {
       return $this->forwardResourceful(__FUNCTION__);
    }
 }
```
And put the following in
config/decorators.php

```php
    'tree' => [
        'users'                => [
            'contract'  => App\Contracts\UserContract::class,
            'arguments' => [
                // First element is the deepest layer
                App\Repositories\UserRepository::class,
                App\Caches\UserCache::class,
                App\Decorators\UserDecorator::class,
            ],
        ],
    ]
```

```

When hitting the route linked to the index method the application will go through the UserDecorator, UserCache and UserRepository. Then it will go back through the same classes, passing the returned data and performing the required actions, like caching and firing events. After everything has been processed the data will be returned using the resource as stated in the `__construct`.

Customization
-------------

[](#customization)

You can set an `enabled` flag within the `config/decorators.php` file. When this is set to false, any decorators implementing the `CrixuAMG\Decorators\Caches\AbstractCache` class will be ignored.

Commands
--------

[](#commands)

To make development even faster and easier, some commands have been created to improve ease of use.

```
    php artisan decorator:cache      ModelCache
    php artisan decorator:repository ModelRepository
    php artisan decorator:contract   ModelContract
```

Or, create all three in a single command:

```
    php artisan decorators:make User
```

For your convenience, a command has been included that automatically creates the following:

- Model
- Controller
- Contract
- Cache
- Repository
- Resource

```
    php artisan decorators:starter User
```

The following options can be used to create extra files:

- `-m` Creates a migration
- `-d` Creates a decorator
- `-r` Creates 4 request classes (Show, Store, Update, Delete) in app/Http/Requests/&lt;MODEL\_NAME&gt;/

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity82

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 99.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~13 days

Recently: every ~8 days

Total

164

Last Release

871d ago

Major Versions

4.6.2 → 5.0.02021-05-12

5.0.2 → 6.0.02021-06-21

6.6.1 → 7.0.02022-05-02

7.7.4 → 8.0.02023-02-08

8.3.0 → 9.0.0-alpha.12023-09-30

PHP version history (6 changes)v0.2.0PHP &gt;=7.1

0.3.0PHP &gt;=7.0

6.2.0PHP &gt;=7.4

7.0.0PHP ^8.0

7.0.3PHP ^8.0|^8.1

8.0.1PHP \*

### Community

Maintainers

![](https://www.gravatar.com/avatar/53958a82150b0934b189c2a8b5190a9d84d4a833181ac700bc0d1399acf1983d?d=identicon)[CrixuAMG](/maintainers/CrixuAMG)

---

Top Contributors

[![CrixuAMG](https://avatars.githubusercontent.com/u/15252590?v=4)](https://github.com/CrixuAMG "CrixuAMG (350 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")

---

Tags

laravelpatterndecoratorcrixuamg

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/crixuamg-laravel-decorators/health.svg)

```
[![Health](https://phpackages.com/badges/crixuamg-laravel-decorators/health.svg)](https://phpackages.com/packages/crixuamg-laravel-decorators)
```

###  Alternatives

[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.5k25.9M107](/packages/laravel-cashier)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[spatie/laravel-enum

Laravel Enum support

3655.4M31](/packages/spatie-laravel-enum)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

74310.9M66](/packages/laravel-mcp)[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
