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

v1.0.2 2025-12-03 11:05 UTC

This package is auto-updated.

Last update: 2025-12-03 11:06:12 UTC


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);