ehough/chaingang

Chain-of-Responsibility / Chain-of-Command pattern in PHP.

Maintainers

Package info

github.com/ehough/chaingang

pkg:composer/ehough/chaingang

Statistics

Installs: 6 934

Dependents: 3

Suggesters: 0

Stars: 4

Open Issues: 1

1.0.3 2013-03-28 18:28 UTC

This package is not auto-updated.

Last update: 2026-02-28 20:26:54 UTC


README

Build Status Project Status: Active - The project has reached a stable, usable state and is being actively developed. Latest Stable Version License Scrutinizer Code Quality Code Coverage

Chain-of-Responsibility/Chain-of-Command pattern for PHP 5.2+

Sample Usage

/*
 * Build some commands.
 */
$command1 = new MyCommand1();   //implements ehough_chaingang_api_Command
$command2 = new MyCommand2();   //implements ehough_chaingang_api_Command

/*
 * Build and assemble the chain.
 */
$chain = new ehough_chaingang_impl_StandardChain();
$chain->addCommand($command1);
$chain->addCommand($command2);

/*
 * Build the execution context.
 */
$context = new ehough_chaingang_impl_StandardContext();
$context->put('foo', 'bar');

/*
 * Execute the chain.
 */
$successfullyHandled = $chain->execute($context);