Abstraction layers for utilizing the "Action" pattern in PHP applications.
You can install the package via composer:
composer require sfneal/actions
Here's a basic example of an action class that accepts a string parameter to the contructor and then outputs the string in all caps from the execute method.
use Sfneal\Actions\AbstractAction;
class MockAction extends AbstractAction
{
/**
* @var mixed|string
*/
private $string;
/**
* MockAction constructor.
*
* @param string $string
*/
public function __construct($string = 'output')
{
$this->string = $string;
}
/**
* Execute the action.
*
* @return mixed
*/
public function execute()
{
return strtoupper($this->string);
}
}
$output = (new MockAction('string'))->execute();
>>> 'STRING'
composer test
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.
This package was generated using the Laravel Package Boilerplate.