ghostwriter / serializer
Serialize and Deserialize PHP objects to JSON
0.1.0
2026-10-04 18:24 UTC
Requires
- php: ~8.4.0 || ~8.5.0 || ~8.6.0
- ext-mbstring: *
- ghostwriter/container: ^7.1.0
Requires (Dev)
- ext-xdebug: *
- boundwize/structarmed: ^0.18.10
- ghostwriter/coding-standard: dev-main
- ghostwriter/phpunit-assertions: ^0.1.1
- mockery/mockery: ^1.6.15
- phpunit/phpunit: ^13.4.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
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.