PHP code example of michael-rubel / laravel-enhanced-pipeline

1. Go to this page and download the library: Download michael-rubel/laravel-enhanced-pipeline 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/ */

    

michael-rubel / laravel-enhanced-pipeline example snippets


use MichaelRubel\EnhancedPipeline\Pipeline;

Pipeline::make()
    ->withEvents()
    ->withTransaction()
    ->send($data)
    ->through([
        // your pipes
    ])
    ->onFailure(function ($data, $exception) {
        // do something when exception caught

        return $data;
    })->then(function ($data) {
        // do something when all pipes completed their work

        return $data;
    });

app(Pipeline::class)
    ...

(new Pipeline(app()))
    ...

(new Pipeline)
    ->setContainer(app())
    ...

$pipeline = Pipeline::make();

$pipeline->run(Pipe::class, $data);

$this->app->resolving(Pipeline::class, function ($pipeline) {
    return $pipeline->via('execute');
});

$this->app->singleton(\Illuminate\Pipeline\Pipeline::class, \MichaelRubel\EnhancedPipeline\Pipeline::class);