sfneal / actions
Abstraction layers for utilizing the 'Action' pattern in PHP applications
Installs: 118 951
Dependents: 7
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=5.6
Requires (Dev)
- phpunit/phpunit: ^5.7.27|^7.5|^8.0 <8.5.12|^9.3
- scrutinizer/ocular: ^1.8
README
Abstraction layers for utilizing the "Action" pattern in PHP applications.
Installation
You can install the package via composer:
composer require sfneal/actions
Usage
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'
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email stephen.neal14@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
Laravel Package Boilerplate
This package was generated using the Laravel Package Boilerplate.