jms/serializer
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
doctrine/annotations | 2.0.1 | 38.86 kB | MIT | prod dev | |
doctrine/instantiator | 2.0.0 | 10.75 kB | MIT | prod | |
doctrine/lexer | 3.0.1 | - | MIT | prod | |
jms/metadata | 2.8.0 | 23.39 kB | MIT | prod | |
phpstan/phpdoc-parser | 1.29.0 | - | MIT | prod |
The JMS/Serializer is a highly effective and flexible library, designed for serializing and deserializing data of any complexity. It's widely recognized for supporting both XML and JSON data formats. Key features include handling of complex exclusion strategies and circular references, integrations with Doctrine ORM and support for many built-in PHP types such as intervals and dates. With JMS/Serializer, you can easily adapt the output to meet your specific needs.
JMS/Serializer library is implemented in your PHP projects by using Composer. Below is a simple example of how to use it:
// Include the Composer autoloader
require 'vendor/autoload.php';
// Instantiate a serializer
$serializer = \JMS\Serializer\SerializerBuilder::create()->build();
// Create data object
$data = new Data();
// Serialize data into json
$jsonContent = $serializer->serialize($data, 'json');
// Deserialize data from json
$data = $serializer->deserialize($jsonContent, 'Data', 'json');
In this example, we first include the Composer autoloader. Then we create an instance of the serializer using the SerializerBuilder class. We then instantiate a Data object which we will serialize into JSON. Lastly, we deserialize data from JSON back into an object of class Data.
The extensive documentation for JMS/Serializer can be found at this page. This documentation provides a comprehensive guide to the usage of the library as well as additional features. It's an essential resource for getting the most functionality out of JMS/Serializer library.