Download the PHP package aol/transformers without Composer

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

Transformers, roll out!

Build Status Latest Stable Version Latest Unstable Version Total Downloads Code Climate

What is this?

Aol/Transformers provides a way to quickly handle two-way data transformations. This is useful for normalizing data from external or legacy systems in your application code or even for cleaning up and limiting responses from your external HTTP API.

But why not just fix the data at the source? If you can, do it! Often though, that's not an option, and that's when you need to "fix" the data at the application layer.

There are two terms you should know:

Basic usage

In a very basic use case a new Transformer instance can be created and the transformation definitions can be defined on the fly. Take a look at the code and then we'll walk thru what's happening.

We have a "Post" array from some external source. It could be MySql, Mongo, an API, the source doesn't really matter. The important part is that we have a post with a few issues. Here's a checklist of things we want to change:

  1. All of the key names should be lowercase snake_case. Oh, and post_tags is kinda silly, we'll make that simply 'tags`.
  2. The post id is always numerical, lets make that an integer.
  3. The post tags are currently a JSON string, lets turn that into a PHP array.

We can make all of these changes by creating a definition for each key. The first argument is the key we want to use in the application, the second argument is the key name that has been forced upon us externally. In many cases (such as title) its enough to just define those two fields.

In cases where we want to actually change the value we can pass in two more arguments. The third argument is a callable that will be applied when we convert to the application context, and the fourth argument is a callable that will be applied when we convert to the external context.

Take a look at the define signature:

Subclass it

Often its useful to reuse a Transformer. In this create a new class that extends the Transformer class and implement the definitions in the constructor.

Leveraging Traits

Many common definitions can be simplified by leveraging the wrapper methods provided by utility traits.

Installation

Contributing

...

License

This project is licensed under the MIT License - see the LICENSE file for details.


All versions of transformers with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
ramsey/array_column Version ^1
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 aol/transformers contains the following files

Loading the files please wait ....