2017 © Pedro Peláez
 

library operation-state

Handle Operation States for executable actions, with the ability to undo. i.e. transactions and rollbacks for PHP

image

sadekbaroudi/operation-state

Handle Operation States for executable actions, with the ability to undo. i.e. transactions and rollbacks for PHP

  • Tuesday, December 31, 2013
  • by sadekbaroudi
  • Repository
  • 1 Watchers
  • 0 Stars
  • 20 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

operation-state Build Status Coverage Status Dependency Status , (*1)

operation-state

Simple PHP classes to handle Operation States for executable actions, with the ability to undo. In other words, helper for transactions and rollbacks within PHP., (*2)

Its purpose is to provide a reliable method for executing actions, and being able to undo those actions when applicable. The functionality will allow you create multiple groups of executable actions and their respective undo actions., (*3)

Usage

use Sadekbaroudi\OperationState\OperationStateManager;
use Sadekbaroudi\OperationState\OperationState;

$yourClass = new YourClassName();

// Instantiate the manager
$osm = new OperationStateManager();

// Note that the setExecute and setUndo require PHP is_callable compliant parameters, as OperationState uses those methods
$os = new OperationState();
$os->setExecute(array($yourClass, 'yourMethod'), array('param1', $param2, array('foo' => 'bar')));
$os->setUndo(array($yourClass, 'undoMethod'), array('param1'));
$osm->add($os);

try {
    $osm->execute($os);
} catch ( OperationStateException $e ) {
    $osm->undo($os);
    throw $e;
}

Installation

Operation State can be installed with Composer by adding the library as a dependency to your composer.json file., (*4)

{
    "require": {
        "sadekbaroudi/operation-state": "*@dev"
    }
}

Please refer to the Composer's documentation for installation and usage instructions., (*5)

The Versions

31/12 2013

dev-master

9999999-dev https://github.com/sadekbaroudi/operation-state

Handle Operation States for executable actions, with the ability to undo. i.e. transactions and rollbacks for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

php states rollback transactions execute operation undo