aipng / json-serializer
json serializer (jms serializer + custom data handlers)
v3.0.4
2024-12-10 13:39 UTC
Requires
- php: >= 8.3
- jms/serializer: ^3.31.1
- symfony/cache: ^v7.1
Requires (Dev)
- aipng/value-objects: ^3.1
- mikey179/vfsstream: ^1.6
- nette/di: ^v3.0
- phpstan/phpstan: ^2.0.3
- phpstan/phpstan-nette: ^2.0
- phpstan/phpstan-phpunit: ^2.0.1
- phpunit/phpunit: ^11.4.2
- symfony/validator: ^7.2
Suggests
- aipng/value-objects: Custom serialization of AipNg value objects
- contributte/validator: To use symfony/validator adapter with a Nette DI extension
- nette/di: Register serializer in Nette DI container
README
JSON Serializer
- JMS Serializer, limited to JSON,
- custom serialization handlers,
- Nette extension
How to install
composer require aipng/json-serializer
Usage
Could be used standalone or as Nette extension.
Nette extension
config.neon
extensions: serializer: AipNg\JsonSerializer\DI\JsonSerializerExtension serializer: temporaryDirectory: %tempDir%/cache productionMode: true # optional validator: # optional serializationHandlers: # optional
Parameters
temporaryDirectory
Use writable path
productionMode
For debugging purposes, true by default
validator
- class, that implements
AipNg\JsonSerializer\Validator
AipNg\JsonSerializer\Validator\NullValidator
is used by default
It could be combined with symfony/validator
with provided adapter. With contributte/validator use this configuration:
extensions: serializer: AipNg\JsonSerializer\DI\JsonSerializerExtension validator: Contributte\Validator\DI\ValidatorExtension serializer: temporaryDirectory: %tempDir%/cache validator: AipNg\JsonSerializer\Validator\SymfonyValidator
serializationHandlers
Specific serialization handlers for JMS serializer. More id JMS documentation.