| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Small library defining a Serializer and a Deserializer interface.
Also contains various Exceptions and a few basic (de)serialization utilities.
You can use Composer to download and install this package as well as its dependencies. Alternatively you can simply clone the git repository and take care of loading yourself.
To add this package as a local, per-project dependency to your project, simply add a dependency on serialization/serialization to your project's composer.json file. Here is a minimal example of a composer.json file that just defines a dependency on Serialization 4.x:
{
"require": {
"serialization/serialization": "^4.0"
}
}
Get the Serialization code, either via git, or some other means. Also get all dependencies. You can find a list of the dependencies in the "require" section of the composer.json file. This file also specifies how the resources provided by this library should be loaded, in its "autoload" section.
This component contains two sub parts, one containing serialization related code, the other holding deserialization specific code. The former is located in the Serializers namespace, while the latter resides in the Deserializers one. Both namespaces are PSR-0 mapped onto the src directory.
The primary thing provided by this library are the Serializer and Deserializer namespaces. A set of Exceptions each process typically can encounter are also provided, and are located in respective Exceptions namespaces. They all derive from SerializationException/DeserializationException.
The main interfaces define the serialize/deserialize methods that do the actual work. In addition there are interfaces with a isSerializerFor/isDeserializerFor method respectively that allows finding out if a given (de)serializer can process a given input.
A DispatchingSerializer and a DispatchingDeserializer are two generally usable implementations of the interfaces that are included in this library. They both do the same thing: contain a list of (de)serializers and dispatch calls to the (de)serialize method to the appropriate one. This allows for bundling multiple (de)serializers together and enables handling of nested data with variable structure.
This library comes with a set up PHPUnit tests that cover all non-trivial code. You can run these tests using the PHPUnit configuration file found in the root directory. The tests can also be run via TravisCI, as a TravisCI configuration file is also provided in the root directory.
The library contains some code that was split factored out of concrete classes part of AskSerialization. Those tests have not been split, hence the low apparent coverage. It is recommended to run the AskSerialization tests when making changes to the code in question.
Serialization has been written by Jeroen De Dauw as Wikimedia Germany employee for the Wikidata project.
| Back | FazBrowse Home | New Git URL |