Download the PHP package nilportugues/serializer without Composer

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

Serializer for PHP

Build Status Scrutinizer Code Quality SensioLabsInsight Latest Stable Version Total Downloads License Donate

Installation

Use Composer to install the package:

Introduction

What is serialization?

In the context of data storage, serialization is the process of translating data structures or object state into a format that can be stored (for example, in a file or memory buffer, or transmitted across a network connection link) and reconstructed later in the same or another computer environment.

Why not serialize() and unserialize()?

These native functions rely on having the serialized classes loaded and available at runtime and tie your unserialization process to a PHP platform.

If the serialized string contains a reference to a class that cannot be instantiated (e.g. class was renamed, moved namespace, removed or changed to abstract) PHP will immediately die with a fatal error.

Is this a problem? Yes it is. Serialized data is now unusable.

Features

Serialization

For the serializer to work, all you need to do is pass in a PHP Object to the serializer and a Strategy to implement its string representation.

Serializers (JSON, XML, YAML)

Example

In the following example a $post object is serialized into JSON.

Code

The object, before it's transformed into an output format, is an array with all the necessary data to be rebuild using unserialize method.

Output

Custom Serializers

If a custom serialization strategy is preferred, the Serializer class should be used instead. A CustomStrategy must implement the StrategyInterface.

Usage is as follows:


Data Transformation

Transformer classes greatly differ from a Strategy class because these cannot unserialize() as all class references are lost in the process of transformation.

To obtain transformations instead of the Serializer class usage of DeepCopySerializer is required.

The Serializer library comes with a set of defined Transformers that implement the StrategyInterface. Usage is as simple as before, pass a Transformer as a $strategy.

For instance:

Following, there are some examples and its output, given the $post object as data to be Transformed.

Array Transformer

Flat Array Transformer

XML Transformer

YAML Transformer

Json Transformer

JsonTransformer comes in 2 flavours. For object to JSON transformation the following transformer should be used:

Output

If your desired output is for API consumption, you may like to check out the JsonTransformer library, or require it using:

JSend Transformer

JSend Transformer has been built to transform data into valid JSend specification resources.

Please check out the JSend Transformer or download it using:

JSON API Transformer

JSON API Transformer has been built to transform data into valid JSON API specification resources.

Please check out the JSON API Transformer or download it using:

HAL+JSON Transformer

HAL+JSON Transformer has been built for HAL+JSON API creation. Given an object and a series of mappings a valid HAL+JSON resource representation is given as output.

Please check out the HAL+JSON API Transformer or download it using:


Quality

To run the PHPUnit tests at the command line, go to the tests directory and issue phpunit.

This library attempts to comply with PSR-2 and PSR-4.

If you notice compliance oversights, please send a patch via pull request.

Contribute

Contributions to the package are always welcome!

Authors

License

The code base is licensed under the MIT license.


All versions of serializer with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.0
symfony/yaml Version 2.*|3.*|4.*
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 nilportugues/serializer contains the following files

Loading the files please wait ....