ovvio / serializer
Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON.
Installs: 17
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/ovvio/serializer
Requires
- php: >=8.4
- symfony/property-access: ^8.0
- symfony/serializer: ^8.0
README
Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON.
Technical Requirements & Installation
PHP 8.4 - Installation and Configuration
Composer (System Requirements)
To install run this:
composer require ovvio/serializer
Examples
<?php ... use Ovvio\Component\Serializer\SerializerFactory; ... /** * Example 1: JSON to array */ /** @var \Ovvio\Component\Serializer\SerializerInterface $serializer */ $serializer = SerializerFactory::create(); /** @var string $json */ $json = <<<JSON { "foo": "Foo", "bar": "Bar" } JSON; /** @var null|array $array */ $array = $serializer->jsonToArray(json: $json); /** * Example 2: array to JSON */ /** @var array $array */ $array = [ 'foo' => 'Foo', 'bar' => 'Bar', ]; /** @var string $json */ $json = $serializer->arrayToJson(array: $array);