PHP code example of czim / laravel-processor

1. Go to this page and download the library: Download czim/laravel-processor 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/ */

    

czim / laravel-processor example snippets


    
    $processor = new Your\Processor();

    $data = new Your\DataObject($someData);
    
    $result = $processor->process($data);
    
    if ( ! $result->success) {
        ...
    }


    /**
     * @return array
     */
    protected function processSteps()
    {
        // Set a series of process step classnames and return it
        // these steps must extend Czim\Processor\Steps\AbstractProcessStep
        // or otherwise implement Czim\Processor\Contracts\ProcessStepInterface
        return [
            Your\ProcessSteps\ClassNameHere::class,
            Your\ProcessSteps\AnotherClassNameHere::class,
        ];
    }


    protected function process()
    {
        // Define your custom processing here.
        // The data object can be accessed through $this->data
        // and the process context through $this->context
    }

    protected $databaseTransaction = false;


    protected function doProcessing()
    {
        // Define your custom processing here.
        // The data object can be accessed through $this->data
        
        // The result data object that will be returned can
        // be modified through $this->result
    }