https://github.com/sfneal/actions
Abstraction layers for utilizing the "Action" pattern in PHP applications
https://github.com/sfneal/actions
actions php php-package
Last synced: 4 months ago
JSON representation
Abstraction layers for utilizing the "Action" pattern in PHP applications
- Host: GitHub
- URL: https://github.com/sfneal/actions
- Owner: sfneal
- License: mit
- Created: 2020-08-12T18:47:26.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-04-16T15:32:14.000Z (almost 2 years ago)
- Last Synced: 2025-01-31T22:38:09.908Z (about 1 year ago)
- Topics: actions, php, php-package
- Language: PHP
- Homepage:
- Size: 57.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Actions
[](https://packagist.org/packages/sfneal/actions)
[](https://packagist.org/packages/sfneal/actions)
[](https://travis-ci.com/sfneal/actions)
[](https://github.styleci.io/repos/287091100?branch=master)
[](https://scrutinizer-ci.com/g/sfneal/actions/?branch=master)
[](https://packagist.org/packages/sfneal/actions)
Abstraction layers for utilizing the "Action" pattern in PHP applications.
## Installation
You can install the package via composer:
```bash
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.
``` php
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);
}
}
```
```php
$output = (new MockAction('string'))->execute();
>>> 'STRING'
```
### Testing
``` bash
composer test
```
## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## Security
If you discover any security related issues, please email stephen.neal14@gmail.com instead of using the issue tracker.
## Credits
- [Stephen Neal](https://github.com/sfneal)
- [All Contributors](../../contributors)
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
## Laravel Package Boilerplate
This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).