Search by

ghostwriter / serializer

ghostwriter

Serialize and Deserialize PHP objects to JSON

Package info

github.com/ghostwriter/serializer

pkg:composer/ghostwriter/serializer

Fund package maintenance!

ghostwriter

Paypal

Statistics

Installs: 325

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.1.0 2026-10-04 18:24 UTC

This package is auto-updated.

Last update: 2026-10-04 18:31:24 UTC


README

Automation PHP Version Packagist Downloads PayPal Sponsors via GitHub

Serialize and Deserialize PHP objects to JSON

Installation

You can install the package via composer:

composer require ghostwriter/serializer

Star ⭐️ this repo if you find it useful

You can also star (🌟) this repo to find it easier later.

Usage

use Ghostwriter\Serializer\Serializer;

$serializer = Serializer::new();

final class Person
{
    public function __construct(
        public string $name,
        public int $age
    ) {
    }
}

$serialized = $serializer->serialize(new Person(name: 'John Doe', age: 30));

var_dump($serialized); // {'__CLASS__':'Person','__ARGUMENTS__':{'name':'John Doe','age':30}}

$deserialized = $serializer->deserialize($serialized);

var_dump($deserialized); // Person { name: 'John Doe', age: 30 }

Credits

Changelog

Please see CHANGELOG.md for more information on what has changed recently.

License

Please see LICENSE for more information on the license that applies to this project.

Security

Please see SECURITY.md for more information on security disclosure process.