Download the PHP package sportuondo/eralda without Composer

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

Dead simple object to array transformation library

Latest Version on Packagist

The objective of this library is to centralize the logic in charge of transforming objects (usually models) into arrays in order to expose them through JSON. Eralda can transform any type of object (PHP standard objects, Laravel Eloquent models...) into an array by just indicating the desired property mapping.

Eralda also offers the possibility of transforming property values as well as embedding related elements (e.g. author → books).

Installation

You can install the package via composer:

Usage

Given the following objects:

We can define the following Transformer:

The $keysMap property is used to define the mapping between the properties of the source object and the keys of the resulting array.

On the other hand, we have included a presenter to modify the resulting value of a property of the original object on the fly. The nomenclature to define presenters is composed of the keyword present followed by the property name of the original object in Camel Case format.

To execute the transformation we would do the following:

The resulting array would look like this:

Transforming collections

In the same way that we transform a single object we can also transform a collection of them. Since we have an array of authors we could do the following:

To get something like this:

Embedding additional elements

We can indicate the elements that we want to embed making use of the property $embeds:

Given the following book transformer:

We could modify our transformer of authors in the following way:

In this case we want to embed the books belonging to the author. The nomenclature to define embeds is composed of the keyword embed followed by the name of the element we want to embed in Camel Case format.

The result would be something like this:

Testing

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of eralda with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1.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 sportuondo/eralda contains the following files

Loading the files please wait ....