Download the PHP package linusshops/pipeline without Composer
On this page you can find all versions of the php package linusshops/pipeline. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download linusshops/pipeline
More information about linusshops/pipeline
Files in linusshops/pipeline
Package pipeline
Short Description A simple tool for step-by-step processing.
License MIT
Informations about the package pipeline
Pipeline - a simple step-by-step processing tool
Based on Laravel's pipeline, this little titan performs step-by-step processing over an object - any object. See https://laravel.com/docs/10.x/helpers#pipeline for more documentation.
Table of Contents
- Installation
- Tests
- Overview
- Pipes can be classes
- Pipes can be closures
- Pipes can abort further processing
- Pipes can move themselves to the end
Installation
This package can be installed via Composer.
Tests
Tests can be run with PHPUnit. After installation run,
Overview
Imagine an event happens in your system, like a CSV file is uploaded, and it triggers some actions,
- the file is validated (ex. size, extension, mime-type, etc.)
- file is processed (ex. parsed and extracted into a relational database)
- file is archived (ex. moved in a remote share)
- notifications need to be sent (ex. emails are sent to business users and the end-user)
You probably, have some objects that are responsible for each of these steps,
- a
- a
- an
- a
Good. And in a traditional OOP application, the calling code would look something like,
Good. Nothing wrong with that. That logic could live anywhere but in a traditional MVC application it'd probably live in a controller, model, or some auxiliary of those.
Now, how does the pipeline do it?
Each pipe will receive the file object and is free to do whatever it wants with it. When it is done its work it can call the next pipe, or not. Let's look at some examples.