Download the PHP package happyr/serializer-bundle without Composer
On this page you can find all versions of the php package happyr/serializer-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download happyr/serializer-bundle
More information about happyr/serializer-bundle
Files in happyr/serializer-bundle
Package serializer-bundle
Short Description A bundle on top of Symfony's serializer. This supports annotations
License MIT
Homepage http://developer.happyr.io
Informations about the package serializer-bundle
Make the Symfony's serializer easy to use.
Install
Via Composer
Enable the bundle in your kernel:
Usage
Under the hood
This bundle provides a custom normalizer to Symfony's serializer component. This makes this serializer very flexible. If you want to serialize an object in a very custom way, add your own serializer as discibed in the Symfony documentation.
Configuration
You need to provide one or more paths to where your source code is.
Adding metadata
Currently you may only configure the normalizer with Annotations. These annotations are very similar to JmsSerializer.
@ExclusionPolicy
This annotation can be defined on a class to indicate the exclusion strategy that should be used for the class.
Policy | Description |
---|---|
all | all properties are excluded by default; only properties marked with @Expose will be serialized/unserialized |
none | no properties are excluded by default; all properties except those marked with @Exclude will be serialized/unserialized |
@Exclude
This annotation can be defined on a property to indicate that the property should not be serialized/unserialized. Works only in combination with ExclusionPolicy = "NONE".
@Expose
This annotation can be defined on a property to indicate that the property should be serialized/unserialized. Works only in combination with ExclusionPolicy = "ALL".
@SerializedName
This annotation can be defined on a property to define the serialized name for a property. If this is not defined, the property will be translated from camel-case to a lower-cased underscored name, e.g. camelCase -> camel_case.
@Groups
This annotation can be defined on a property to specifiy to if the property should be serialized when only serializing specific groups. If this is excluded the property/method will get group "Default".
@Accessor
This annotation can be defined on a property to specify which public method should be called to retrieve, or set the value of the given property. By default we access properties by reflection.
@ReadOnly
This annotation can be defined on a property to indicate that the data of the property is read only and cannot be set during deserialization.
A property can be marked as non read only with @ReadOnly(false)
annotation (useful when a class is marked as read only).
All versions of serializer-bundle with dependencies
symfony/serializer Version ^2.7.10|^3.0
symfony/finder Version ^2.7|^3.0
doctrine/annotations Version ^1.2
twig/twig Version ^1.18|^2.0