sfneal/actions

Abstraction layers for utilizing the 'Action' pattern in PHP applications

Maintainers

👁 sfneal

Package info

github.com/sfneal/actions

pkg:composer/sfneal/actions

Statistics

Installs: 156 333

Dependents: 7

Suggesters: 0

Stars: 1

Open Issues: 0

2.1.0 2024-03-29 19:57 UTC

Requires

  • php: >=5.6

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 86a0df2038f8ec2b3b45e7071159197379e14ee8

  • Stephen Neal <stephen.neal14.woop@gmail.com>

actionssfneal

This package is auto-updated.

Last update: 2026-06-16 19:58:54 UTC


README

👁 Packagist PHP support
👁 Latest Version on Packagist
👁 Build Status
👁 StyleCI
👁 Scrutinizer Code Quality
👁 Total Downloads

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.