flaphl/reissue

handles serializing and deserializing data structures, including, into array structures or other formats like XML and JSON.

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/flaphl/reissue

v1.0.0 2025-10-19 22:18 UTC

This package is auto-updated.

Last update: 2025-10-19 22:22:15 UTC


README

A modern PHP 8.2+ serialization/deserialization library with metadata-driven normalization, context builders, and PSR compliance.

Installation

composer require flaphl/reissue

Basic Usage

use Flaphl\Element\Reissue\Reissue;

$reissue = new Reissue();

// Serialize
$json = $reissue->reissue($object, 'json');

// Deserialize
$object = $reissue->deissue($json, MyClass::class, 'json');

Features

  • Multiple Formats: JSON, XML, and array support
  • Metadata System: PHP 8 attributes for serialization control
  • Context Builders: Fluent API for encoder/decoder configuration
  • Chain Support: Chain multiple encoders/normalizers
  • Magic Method Protection: Automatic __sleep, __wakeup, __serialize, __unserialize handling
  • Performance Tracking: Built-in data collector for monitoring
  • PSR Compliant: PSR-6 cache integration

Attributes

use Flaphl\Element\Reissue\Attribute\{Groups, Ignore, MaxDepth, SerializedName};

class User
{
    #[Groups(['public'])]
    public string $name;
    
    #[SerializedName('email_address')]
    public string $email;
    
    #[Ignore]
    public string $password;
    
    #[MaxDepth(2)]
    public array $posts;
}

Context Builders

use Flaphl\Element\Reissue\Context\Encoder\JsonEncoderContextBuilder;

$context = (new JsonEncoderContextBuilder())
    ->withPrettyPrint()
    ->withUnescapedUnicode()
    ->withGroups(['public'])
    ->build();

$json = $reissue->reissue($user, 'json', $context);

Requirements

  • PHP 8.2 or higher
  • symfony/cache (optional, for cached metadata)

License

MIT License. See LICENSE file.