A simple package to clean up cluttered controllers.
If there is one thing I hate, its cluttered controllers, to fix that problem in big applications, I came up with my own method/layer to put all the logic in: the processor layer!, (*1)
Using this package is very simple!
This package comes with 2 artisan commands;
processor:init - Creates the Processors folder in the App folder and 2 base classes inside the Processors folder.
make:processor - Creates a an empty processor., (*2)
Calling a processor from anywhere is very simple;
- Import the processor facade at the top:
- Call a processor to be executed:
return Processor::init('TestProcessor', array('next' => 'home'))->function();., (*3)
Installing this package is very simple;
- Install the package with composer:
composer require muilman/processors.
- Add the service provider to Config/app.php:
- Optional: Add the Processors alias to the aliases in Config/app.php:
'Processor' => '\App\Processors\BaseProcessor',., (*4)