PHP code example of kitpages / chain-bundle

1. Go to this page and download the library: Download kitpages/chain-bundle 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/ */

    

kitpages / chain-bundle example snippets



namespace Kitpages\ChainBundle\Tests\Sample;

use Kitpages\ChainBundle\Step\StepAbstract;

class StepSample extends StepAbstract
{
    public function execute() {
        // do whatever you want
        return $whatever;
    }
}

namespace Foo\Bar;
class StepListener
{
    public function onStepExecute(StepEvent $event)
    {
        $step = $event->getStep();
        // do whatever you want with the current step
        // $event->preventDefault();
        // $event->stopPropagation();
        // log something ?
    }
}
 bash
$ php composer.phar update kitpages/chain-bundle
 php
$bundles = array(
    ...
    new Kitpages\ChainBundle\KitpagesChainBundle(),
);
 bash
# lancer une stepe avec les paramètres du config.yml
php app/console kitpages:chain:run-step CodeCopy

# lancer une stepe en écrasant des paramètres du config.yml
php app/console kitpages:chain:run-step CodeCopy --p=src_dir:'/home/webadmin/src' --p=dest_dir:'/tmp/destDir'
 php
$stepKitpages = $this->get("kitpages_chain.step");
$codeCopyStepKitpages = $stepKitpages->getStep('CodeCopy');
$codeCopyStepKitpages->setParameter('src_dir', '/home/webadmin/htdocs/dev/cms2.kitpages.com');

$codeCopyStepKitpages->execute();
 php

$chainManager = $this->get("kitpages_chain.chain");
$kitpagesMepChainKitpages = $chainManager->getChain('kitpagesMep');
$stepList = $kitpagesMepChainKitpages->getStepList();
$stepList['GitKitpagesLabel']->setParameter('url', 'git2.kitpages.com');
 php
use Kitpages\ChainBundle\Step\StepEvent;
[...]

$event = new StepEvent();

$stepKitpages = $this->get("kitpages_chain.step");
$codeCopyStepKitpages = $stepKitpages->getStep('CodeCopy');
$codeCopyStepKitpages->setParameter('src_dir', '/home/webadmin/htdocs/dev/cms2.kitpages.com');

$codeCopyStepKitpages->execute($event);