Download the PHP package b2pweb/bdf-serializer without Composer
On this page you can find all versions of the php package b2pweb/bdf-serializer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download b2pweb/bdf-serializer
More information about b2pweb/bdf-serializer
Files in b2pweb/bdf-serializer
Informations about the package bdf-serializer
Serializer
The Bdf Serializer can normalize, hydrate / extract and encode data or object. It use doctrine/instantiator for instancing class and phpdocumentor for reading annotations.
Installation with Composer
Basic usage
Declare metadata
2 drivers are available. The static method called and the annotations driver.
Static method driver
Declare your static method to build metadata
Annotations driver
The annotations driver use phpdocumentor/reflection-docblock. The tag @var
will be read.
If no tag is found, the default type is string
.
Supported tags
var
: This annotation specify the type of the property. This tag is mandatory for deserialization.since
: Enable object versionning. The value specify starting from which version this property is available.until
: Enable object versionning. The value specify until which version this property was available.SerializeIgnore
: Don't serialize this property.
NOTE: If type has not been detected in the phpdoc we try to add the typed property value added in PHP 7.4
JMS/serializer driver
The driver Bdf\Serializer\Metadata\Driver\JMSAnnotationDriver
allows you to use JMS drivers.
The JMS metadata will be used to create Bdf metadata. Only few options of the serializer is used:
serializedName
readOnly
inline
sinceVersion
untilVersion
getter
setter
groups
type
NOTE: The driver works with jms/serializer > v3.0 and php > v7.2
Serialization options
The NormalizationContext
contains options for normalization.
exclude
: Properties to exclude from normalization .include
: Properties to include from normalization.groups
: Groups of properties to include.null
: Null value will be added if true.meta_type
: Include the metadata "@type" in the payload.version
: Set the version for object that support versionning serialization.The string version should be compatible with PHP functionversion_compare
.circular_reference_limit
: Number of circular reference. Default 1.remove_default_value
: Don't inject the value of a property if it is set to its default value.
Date time options
dateFormat
: Normalization option to specify the format.dateTimezone
: Use the given timezone to format date.timezoneHint
: Denormalization option to help to detect the timezone from input string.
Available option for NormalizationContext
and DenormalizationContext
.
throws_on_accessor_error
: By default a value is skipped if anError
is thrown when writting or reading on a property. This option will throw error from accessor (debug purpose).
Exemple:
All versions of bdf-serializer with dependencies
doctrine/instantiator Version ^1.0.3|^2.0.0
phpdocumentor/reflection-docblock Version ^4.0|~5.0
psr/simple-cache Version ^1.0|~2.0|~3.0