chubbyphp / chubbyphp-deserialization
Chubbyphp Deserialize
Installs: 52 885
Dependents: 3
Suggesters: 0
Security: 0
Stars: 7
Watchers: 2
Forks: 8
Open Issues: 1
Requires
- php: ^8.1
- ext-dom: *
- ext-json: *
- ext-mbstring: *
- chubbyphp/chubbyphp-decode-encode: ^1.1
- psr/http-message: ^1.1|^2.0
- psr/log: ^2.0|^3.0
Requires (Dev)
- chubbyphp/chubbyphp-container: ^2.2
- chubbyphp/chubbyphp-dev-helper: dev-master
- chubbyphp/chubbyphp-laminas-config-factory: ^1.3
- chubbyphp/chubbyphp-mock: ^1.7.0
- doctrine/collections: ^2.1.4
- doctrine/persistence: ^3.2
- infection/infection: ^0.27.8
- php-coveralls/php-coveralls: ^2.7.0
- phpstan/extension-installer: ^1.3.1
- phpstan/phpstan: ^1.10.45
- phpunit/phpunit: ^10.4.2
- pimple/pimple: ^3.5
- psr/container: ^2.0.2
- symfony/config: ^5.4.31|^6.3.8|^7.0
- symfony/dependency-injection: ^5.4.31|^6.3.8|^7.0
- dev-master / 4.1.x-dev
- 4.1.1
- 4.1.0
- 4.0.0
- v3.x-dev
- 3.5.2
- 3.5.1
- 3.5.0
- 3.4.1
- 3.4.0
- 3.3.4
- 3.3.3
- 3.3.2
- 3.3.1
- 3.3.0
- 3.2.0
- 3.1.1
- 3.1.0
- 3.0.1
- 3.0.0
- 3.0-rc1
- v2.x-dev
- 2.19.0
- 2.18.0
- 2.17.2
- 2.17.1
- 2.17.0
- 2.16.0
- 2.15.5
- 2.15.4
- 2.15.3
- 2.15.2
- 2.15.1
- 2.15.0
- 2.14.2
- 2.14.1
- 2.14.0
- 2.13.1
- 2.13.0
- 2.12.0
- 2.11.0
- 2.10.0
- 2.9.2
- 2.9.1
- 2.9.0
- 2.8.0
- 2.7.4
- 2.7.3
- 2.7.2
- 2.7.1
- 2.7.0
- 2.6.0
- 2.5.1
- 2.5.0
- 2.4.0
- 2.3.1
- 2.3.0
- 2.2.1
- 2.2.0
- 2.1.2
- 2.1.1
- 2.1.0
- 2.1-beta2
- 2.1-beta1
- 2.0.8
- 2.0.7
- 2.0.6
- 2.0.5
- 2.0.4
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 2.0-beta11
- 2.0-beta10
- 2.0-beta9
- 2.0-beta8
- 2.0-beta7
- 2.0-beta6
- 2.0-beta5
- 2.0-beta4
- 2.0-beta3
- 2.0-beta2
- 2.0-beta1
- 2.0-alpha10
- 2.0-alpha9
- 2.0-alpha8
- 2.0-alpha7
- 2.0-alpha6
- 2.0-alpha5
- 2.0-alpha4
- 2.0-alpha3
- 2.0-alpha2
- 2.0-alpha1
- v1.x-dev
- 1.2.0
- 1.1.2
- 1.1.1
- 1.1.0
- 1.1-beta5
- 1.1-beta4
- 1.1-beta3
- 1.1-beta2
- 1.1-beta1
- 1.0.0
- 1.0-alpha2
- 1.0-alpha1
This package is auto-updated.
Last update: 2024-11-10 20:34:07 UTC
README
Description
A simple deserialization.
Requirements
- php: ^8.1
- chubbyphp/chubbyphp-decode-encode: ^1.1
- psr/http-message: ^1.1|^2.0
- psr/log: ^2.0|^3.0
Suggest
- chubbyphp/chubbyphp-container: ^2.2
- pimple/pimple: ^3.5
- psr/container: ^2.0.2
- symfony/config: ^5.4.31|^6.3.8|^7.0 (symfony integration)
- symfony/dependency-injection: ^5.4.31|^6.3.8|^7.0 (symfony integration)
Installation
Through Composer as chubbyphp/chubbyphp-deserialization.
composer require chubbyphp/chubbyphp-deserialization "^4.1"
Usage
Accessor
Denormalizer
Field Denormalizer
- CallbackFieldDenormalizer
- DateTimeImmutableFieldDenormalizer
- FieldDenormalizer
- ConvertTypeFieldDenormalizer
Relation Field Denormalizer
- EmbedManyFieldDenormalizer
- EmbedOneFieldDenormalizer
- ReferenceManyFieldDenormalizer
- ReferenceOneFieldDenormalizer
Denormalizer Context
DenormalizerObjectMappingRegistry
Deserializer
<?php use Chubbyphp\DecodeEncode\Decoder\Decoder; use Chubbyphp\DecodeEncode\Decoder\JsonTypeDecoder; use Chubbyphp\DecodeEncode\Decoder\JsonxTypeDecoder; use Chubbyphp\DecodeEncode\Decoder\UrlEncodedTypeDecoder; use Chubbyphp\DecodeEncode\Decoder\XmlTypeDecoder; use Chubbyphp\DecodeEncode\Decoder\YamlTypeDecoder; use Chubbyphp\Deserialization\Denormalizer\Denormalizer; use Chubbyphp\Deserialization\Denormalizer\DenormalizerObjectMappingRegistry; use Chubbyphp\Deserialization\Deserializer; use MyProject\Deserialization\ModelMapping; use MyProject\Model\Model; $logger = ...; $deserializer = new Deserializer( new Decoder([ new JsonTypeDecoder(), new JsonxTypeDecoder(), new UrlEncodedTypeDecoder(), new XmlTypeDecoder(), new YamlTypeDecoder() ]), new Denormalizer( new DenormalizerObjectMappingRegistry([ new ModelMapping() ]), $logger ) ); $model = $deserializer->deserialize( Model::class, '{"name": "php"}', 'application/json' ); echo $model->getName(); // 'php' print_r($deserializer->getContentTypes()); //[ // 'application/json', // 'application/jsonx+xml', // 'application/x-www-form-urlencoded', // 'application/xml', // 'application/x-yaml' //] print_r($deserializer->decode( '{"name": "php"}', 'application/json' )); // ['name' => 'php'] $model = $denormalizer->denormalize( Model::class, ['name' => 'php'] ); echo $model->getName(); // 'php'
Mapping
DenormalizationFieldMapping
DenormalizationObjectMapping
LazyDenormalizationObjectMapping
Policy
ServiceFactory
chubbyphp-container
chubbyphp-laminas-config-factory
- DenormalizationFieldMappingFactoryFactory
- DenormalizerFactory
- DenormalizerObjectMappingRegistryFactory
- DeserializerFactory
ServiceProvider
Copyright
2024 Dominik Zogg