Download the PHP package smartgroup/smart-serializer without Composer
On this page you can find all versions of the php package smartgroup/smart-serializer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download smartgroup/smart-serializer
More information about smartgroup/smart-serializer
Files in smartgroup/smart-serializer
Package smart-serializer
Short Description Smart-serializer is a tiny library which allows to serialize PHP objects. It supports routes, translations and nested objects of Symfony.
License MIT
Informations about the package smart-serializer
smart-serializer
It's the tiny library which can be used in any of PHP projects, however it was designed mainly to support Symfony projects (Symfony 6 and above).
How to install
Call following command to add it to your project:
How to use
This library is easy to use. For the entity or object which needs to be serialized, just annotate it's properties or methods with Snapshot
annotation.
Having the code above you will receive a serialized object, which contains fields which are annotated. To receive the serialized object just call:
Snapshot annotation options
Annotating the object with Snapshot annotation, you have following options:
- isObject - field is an object which should be serialized as well
- isDate - object is a date
- dateFormat - if object is a date you can specify the output format of date, by default it is 'Y-m-d H:i:s'
- fieldName - by default name of the value is the field name, but you can overwrite the name by putting value here
- isRoute - it will parse the value to extract the real route using symfony/router (it requires to pass symfony/router interface to getSnapshot method)
- isCollection - it will extract the value as the serialized collection
- translate - it will translate the value using symfony/translate (it requires to pass symfony/translate interface to getSnapshot method)
Contributing
This project is maintained by a community of developers. Contributions are welcome and appreciated. You can find Jodit on GitHub; feel free to start an issue or create a pull requests: https://github.com/mtulikowski/smart-serializer
All versions of smart-serializer with dependencies
doctrine/orm Version ^2.13
doctrine/annotations Version ^1.13.3
symfony/translation Version ^6.1
symfony/routing Version ^6.1