This repository was archived by the owner on Jun 16, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Home
CrixuAMG edited this page Mar 11, 2018
·
1 revision
This wiki has been written to provide documentation on how to use laravel-decorators within your Laravel 5+ project. If you've got any problems, please use this wiki, provided answers in the issues section on GitHub or create an issue yourself.
Run the following command within your terminal application:
composer require crixuamg/laravel-decoratorsThen, publish the config file using
php artisan vendor:publishUsing Laravel < 5.5? Go to your config/app.php and add the service provider:
CrixuAMG\Decorators\DecoratorServiceProvider::class,Run php artisan make:provider RepositoryServiceProvider.
Then, within the newly created provider register any set of class that you want to use the decorator pattern with.
Example:
use CrixuAMG\Decorators\Handler;
public function register()
{
/**
* User repository
*/
decorator()->decorate(UserContract::class, [
UserRepository::class,
UserCache::class,
]);
}