PHP code example of aambr / phpchain

1. Go to this page and download the library: Download aambr/phpchain library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

aambr / phpchain example snippets


$dispatcher = new ChainDispatcher($dependencyInjectionContainer);
$dispatcher->chain('user.register')->define([
  'Steps\CreateUserStep', Steps\CreateProfileStep::class, 'sendWelcomeEmail'
]); // all of these will be resolved by dependency container unless 
    // there is a concrete ChainStep object ready
    
$dispatcher->chain('user.register')->dispatch()->execute(new \ArrayObject([
  'username' => 'valid-username',
  'email' => '[email protected]'
]));