Download the PHP package crell/transformer without Composer

On this page you can find all versions of the php package crell/transformer. 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 transformer

Transformer Bus

Build Status

This is a simple library that simplifies building of transformation pipelines based on typed PHP objects.

"What does that mean?"

Consider this scenario: You have some process or set of processes, which in the end should result in an object of some type. However, your various processes may output objects of a variety of different types depending on their use case. But you want all of those to eventually end up as that final type.

What this library lets you do is create "transformers" that know how to convert from one object to another. You can then trivially string them together, and give the main transformer bus any object that it knows how to handle. It will then produce an object of the final type.

As a concrete example, say you want to produce a Response object for your framework (Symfony, Zend, whatever), but your controller could return a number of possible domain objects specific to your application. Say, an object out of your model, or an HTML representation of that domain model object, or a complete HTML page that contains that HTML representation of the domain model.

Each of those is a separate task that transforms data from one representation to another.

Each of those steps is a transformation, and is carried out by a transformer. A transformer is simply a PHP callable that takes an object of one type and returns an object of another.

Usage

Using the example above, we could wire it up something like this.

First we have our various domain model classes:

Now we setup transformers for all of them, and wire them into a bus:

Now we can use that bus like so:

In each case, only those transformers that are appropriate will be executed but we will always reliably end up with a $response in the end. That means that, in a web framework, our controller can return any of Product, Customer, HtmlBody, HtmlPage, or Response, and we'll reliably get a Response at the end.

There are no doubt many other use cases, but that's the one I had in mind when writing this library originally.

Reflective Bus

An extra implementation is available, ReflectiveTransformerBus. It works the same way as TransformerBus, but you may register transformers like so:

And it will use reflection to register that callable for Product classes without having to be told explicitly. That's more convenient but has a small overhead for the reflection process.

Installation

The preferred method of installation is via Composer with the following command:

composer require crell/transformer

See the [Composer documentation][2] for more details.

See also

For users of the Symfony framework, another variant is available that will accept Symfony "extended callables", so you can register services as transformers and they won't be loaded until/unless used. See TransformerBundle.

License

The LGPL License, version 3 or, at your option, any later version. Please see License File for more information.


All versions of transformer with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4.0
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 crell/transformer contains the following files

Loading the files please wait ....