Download the PHP package terrazza/serializer without Composer
On this page you can find all versions of the php package terrazza/serializer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package serializer
the serializer component
This component is meant to be used to turn objects into a specific format (XML,JSON,YAML,...) and the other way around.
- Methods
- Deserializer
- Decoder
- Denormalizer
- method: denormalize
- method: denormalizeMethodValues
- Serializer
- Normalizer
- Encoder
- Factory
- DeserializerFactory
- SerializerFactory
- Deserializer
- Examples
- Deserialize + Serialize Json (without Factory)
- Denormalize::denormalizeMethodValues
- Install
- Requirements
Deserializer
Deserializer is a combination of
- decode (JSON,XML,CSV) a given string into an array
- denormalize into a class
Decode
The decoder converts a given string into an array. Actually Terrazza/Serializer supports
method: denormalizeClass
This method convert in input into the given className and
- validate input types
- load/handle nested objects
Properties:
- className (string)
- input (mixed)
- restrictArguments (default: false)
Business logic
- initialize className with __constructor (if public)
- handle unused arguments with "setter"-methods (if public)
method: denormalizeMethodValues
This method map/convert given arguments into/based on an object and his methodName.
Properties:
- object
- methodName (string)
- input (mixed)
- restrictArguments (default: false)
How should a class be designed
We suggest that all required arguments are handled by the __constructor
and all optional arguments are handled by the setter.
Serializer
Serialize is a combination of
- normalize object to array
- encode array to (JSON,..)
Normalizer
The Normalizer converts an object into an array.
Business logic
- try to find for all properties by there "getter" methods (get{}, is{}, has{})
found: retrieve related property value - for all properties, public accessible mandatory (not handled by methods)
found: retrieve property value
Encoder
The encoder converts an array to a string by using.
actually provided encodings:
- Json
Factory
Every factory covers his parent and provides, "contentType" based, an automatic execution.
DeserializerFactory
SerializerFactory
`
Examples
Unserialize + Serialize JSON (without Factory)
`
Denormalizer::denormalizeMethodValues
`
How to install
Install via composer
Requirements
php version
- >= 7.4
php extension
- ext-json
- ext-libxml
composer packages
- psr/log
- terrazza/annotation
composer packages (require-dev)
- terrazza/logger
All versions of serializer with dependencies
psr/log Version 1.1.*
ext-json Version *
ext-libxml Version *
terrazza/reflectionclass Version 1.0.*