Download the PHP package toobo/pipepie without Composer

On this page you can find all versions of the php package toobo/pipepie. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package pipepie

PipePie

travis-ci

Introduction

PipePie is a generic tool to apply a set of callbacks to some input data to obtain some output data.

So:

Every callback in the pipeline receives as 1st argument the value returned by previous callback. The 1st callback receives the input data.

Note that callbacks may be anything that evaluates as callable in PHP, so not only closures.

E.g. is possible to use invokable objects (i.e objects that have an __invoke() method) to improve code reusability.

Initial Value Access

The second argument that callbacks in the pipeline receive, is always the initial value, i.e. the value that was passed to Pipeline::applyTo()

In this way, every callback in the pipeline can do its work with being aware of the initial value.

DTO

DTO stands for "Data Transportation Object".

PipePie uses this kind of object to make possible to pass data across callbacks.

In fact, 3rd argument that callbacks receive is an instance of Toobo\PipePie\DTO class that is a very simple object that implements ArrayAccess interface.

Once this object instance is the same for all the callbacks in the pipeline, is possible to use it to pass data from a callback to next ones.

For the sake of data integrity, DTO implements ArrayAccess in a way that:

Context

As shown above, DTO is a good way to pass data from a callback to others.

Sometimes may be desirable to pass some context to all the callbacks, at Pipeline level.

That can be done by passing context data as 1st argument to Pipeline constructor. After that, context is reachable inside callbacks via DTO::context() method, called on the DTO instance that is passed to callbacks.

DTO "freshness"

Every time Pipeline::applyTo() is called on same Pipeline instance, DTO instance passed to callbacks is a fresh one, i.e. DTO state is not maintained across applyTo() calls.

Only DTO::context() returns the same value because it is set at Pipeline level.

Auto Type Casting

May be desirable to be sure that every callback in the pipeline returns a specific data type. PipePie allows to do that in 2 ways:

Type Casting via Flag

Pipeline class has some constants:

Passing one of them as 2nd argument to Pipeline constructor is possible be sure that the type returned by all the callbacks is the desired one.

Note that, by default, initial value passed to 1st callback, is not type casted (but its returning value is).

However, it's also possible to type cast even the initial value before it is passed to first callback. That can be done by passing true as 3rd argument to Pipeline constructor.

Type Casting via Custom Callback

Is possible to pass as 2nd argument to Pipeline constructor a callback that can be used to type cast the value returned by all the callbacks in the Pipeline.

Even if main scope of type-casting custom callback is, in fact, type-cast Pipeline callbacks result, it can be actually used to do anything.

Callback Additional Arguments

In the examples above is shown how Pipeline callbacks receive at least 3 arguments:

It is possible to pass additional arguments on a callback basis.

That is done by passing an array of arguments as 2nd argument for Pipeline::pipe() method:

Nested Pipelines

If you like the fact that invokable objects can be used as callback to promote code reusability, you'll love the fact that Pipeline class implements an __invoke() method, that allows to use any Pipeline as a callback to be added to a "parent" Pipeline.

Note that when using nested pipelines, just like in code above, DTO is shared among pipelines, i.e. DTO instance is the same for callbacks in parent pipeline and callbacks in child pipelines.

Debug Aids

Pipeline class has a method: info() that gives information on:

Note that:

Requirements

Installation

Unit Tests

PipePie repository contains some unit tests written for PHPUnit.

To run tests, navigate to repo folder from console and run:

License

PipePie is released under MIT, see LICENSE file for more info.


All versions of pipepie with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package toobo/pipepie contains the following files

Loading the files please wait ....