{"id":18963776,"url":"https://github.com/opensoft/opensoftsimpleserializerbundle","last_synced_at":"2026-03-07T22:32:47.292Z","repository":{"id":4457806,"uuid":"5596457","full_name":"opensoft/OpensoftSimpleSerializerBundle","owner":"opensoft","description":"Simple PHP Serializer bundle for Symfony 2.*","archived":false,"fork":false,"pushed_at":"2018-01-23T16:06:25.000Z","size":17,"stargazers_count":9,"open_issues_count":0,"forks_count":3,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-29T07:51:25.476Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/opensoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-08-29T06:06:53.000Z","updated_at":"2022-08-02T13:49:12.000Z","dependencies_parsed_at":"2022-09-21T11:11:29.818Z","dependency_job_id":null,"html_url":"https://github.com/opensoft/OpensoftSimpleSerializerBundle","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opensoft%2FOpensoftSimpleSerializerBundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opensoft%2FOpensoftSimpleSerializerBundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opensoft%2FOpensoftSimpleSerializerBundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opensoft%2FOpensoftSimpleSerializerBundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/opensoft","download_url":"https://codeload.github.com/opensoft/OpensoftSimpleSerializerBundle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249201117,"owners_count":21229004,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T14:21:39.473Z","updated_at":"2026-03-07T22:32:47.236Z","avatar_url":"https://github.com/opensoft.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"OpensoftSimpleSerializerBundle\n==============================\n\nIntroduction\n------------\n\nOpensoftSimpleSerializerBundle is wrapper for \u003ca href=\"https://github.com/opensoft/simple-serializer\"\u003esimple-serializer\u003c/a\u003e library.\n\n[![Build Status](https://secure.travis-ci.org/opensoft/OpensoftSimpleSerializerBundle.png?branch=master)](http://travis-ci.org/opensoft/OpensoftSimpleSerializerBundle)\n[![Total Downloads](https://poser.pugx.org/opensoft/opensoft-simple-serializer-bundle/downloads.png)](https://packagist.org/packages/opensoft/opensoft-simple-serializer-bundle)\n[![Latest Stable Version](https://poser.pugx.org/opensoft/opensoft-simple-serializer-bundle/v/stable.png)](https://packagist.org/packages/opensoft/opensoft-simple-serializer-bundle)\n[![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/opensoft/OpensoftSimpleSerializerBundle/badges/quality-score.png?s=5944c51914658e14d6add8f7a6f602c1d36ba644)](https://scrutinizer-ci.com/g/opensoft/OpensoftSimpleSerializerBundle/)\n\nInstallation\n------------\n\nUsing Composer (recommended)\n----------------------------\n\nTo install OpensoftSimpleSerializerBundle with Composer just add the following to your composer.json file:\n\n```yml\n// composer.json\n{\n    // ...\n    require: {\n        // ...\n        \"opensoft/opensoft-simple-serializer-bundle\": \"1.0.*\"\n    }\n}\n```\n\nThen, you can install the new dependencies by running Composer’s update command from the directory\nwhere your composer.json file is located:\n\n```bash\n$ php composer.phar update\n```\n\nComposer will automatically download all required files, and install them for you.\nAll that is left to do is to update your AppKernel.php file, and register the new bundle:\n\n```php\n\u003c?php\n// in AppKernel::registerBundles()\n$bundles = array(\n    // ...\n    new Opensoft\\Bundle\\SimpleSerializerBundle\\OpensoftSimpleSerializerBundle($this),\n    // ...\n);\n```\n\nUsing the deps file (Symfony 2.0.x)\n-----------------------------------\n\nUpdate your deps file\n\n```yml\n### SimpleSerializer library\n[simple-serializer]\n    git=git://github.com/opensoft/simple-serializer.git\n### SimpleSerializer bundle\n[OpensoftSimpleSerializerBundle]\n    git=git://github.com/opensoft/OpensoftSimpleSerializerBundle.git\n    target=bundles/Opensoft/Bundle/SimpleSerializerBundle\n```\n\nUpdate your AppKernel.php file, and register the new bundle:\n\n```php\n// in AppKernel::registerBundles()\n$bundles = array(\n    // ...\n    new Opensoft\\Bundle\\SimpleSerializerBundle\\OpensoftSimpleSerializerBundle($this),\n    // ...\n);\n```\n\nMake sure that you also register the namespaces with the autoloader:\n\n```php\n\u003c?php\n// app/autoload.php\n$loader-\u003eregisterNamespaces(array(\n    // ...\n    'Opensoft'  =\u003e __DIR__.'/../vendor/bundles',\n    'Opensoft\\\\SimpleSerializer' =\u003e __DIR__.'/../vendor/simple-serializer/src',\n    // ...\n));\n```\n\nNow use the vendors script to clone the newly added repositories into your project:\n\n```bash\n$ php bin/vendors install\n```\n\n\nConfiguration\n-------------\n\nOpensoftSimpleSerializerBundle requires no initial configuration to get you started.\n\nBelow you find a reference of all configuration options with their default values:\n\n```yml\n# config.yml\nopensoft_simple_serializer:\n    metadata:\n        cache: file\n        debug: \"%kernel.debug%\"\n        file_cache:\n            dir: \"%kernel.cache_dir%/simple-serializer\"\n        # Using auto-detection, the mapping files for each bundle will be\n        # expected in the Resources/config/simple-serializer directory.\n        #\n        # Example:\n        # class: My\\FooBundle\\Entity\\User\n        # expected path: @MyFooBundle/Resources/config/simple-serializer/Entity.User.yml\n        auto_detection: true\n        # if you don't want to use auto-detection, you can also define the\n        # namespace prefix and the corresponding directory explicitly\n        directories:\n            any-name:\n                namespace_prefix: \"My\\\\FooBundle\"\n                path: \"@MyFooBundle/Resources/config/simple-serializer\"\n            another-name:\n                namespace_prefix: \"My\\\\BarBundle\"\n                path: \"@MyBarBundle/Resources/config/simple-serializer\"\n```\n\nUsage\n-----\n\nFirstly, you could create mapping files for your objects.\n\n```yml\n# MyBundle\\Resources\\config\\serializer\\ClassName.yml\nFully\\Qualified\\ClassName:\n    properties:\n        some-property:\n            expose: false\n            type: string\n            serialized_name: foo\n            since_version: 1.0\n            until_version: 2.0\n            groups: ['get','patch']\n```\n\nBelow you find a reference of all configuration options for property:\n\n* expose\n * true\n * false (default)\n* type\n * integer\n * boolean\n * double\n * string\n * array\n * T - fully qualified class name\n * array\\\u003cT\\\u003e\n * DateTime (default format is ISO8601)\n * DateTime\\\u003cformat\\\u003e\n  * format could be name of DateTime constant (COOKIE, ISO8601) or string\n* serialized_name\n * default value is equal name property\n* since_version\n * string\n* until_version\n * string\n* groups\n * array\n\n\nThen you could use \"simple_serializer\" service.\n\n\n```php\n\u003c?php\n//serialization\n$serializer = $container-\u003eget('simple_serializer');\n$string = $serializer-\u003eserialize($object);\n//Serialize array of the objects\n$string = $serializer-\u003eserialize(array($object));\n//Serialize specific groups\n$serializer-\u003esetGroups(array('get'));\n$string = $serializer-\u003eserialize($object);\n//Serialize specific version\n$serializer-\u003esetVersion('1.0');\n$string = $serializer-\u003eserialize($object);\n//deserialization\n$object = $serializer-\u003eunserialize($jsonData, $object);\n//Unserialize array of the objects\n$objects = $serializer-\u003eunserialize($jsonData, array($object));\n//Unserialize specific groups\n$serializer-\u003esetGroups(array('get'));\n$object = $serializer-\u003eunserialize($jsonData, $object);\n//Unserialize specific version\n$serializer-\u003esetVersion('1.0');\n$object = $serializer-\u003eunserialize($jsonData, $object);\n//Strict unserialize mode\n$serializer-\u003esetStrictUnserializeMode(2);\n$object = $serializer-\u003eunserialize($jsonData, $object);\n//Medium Strict unserialize mode\n$serializer-\u003esetStrictUnserializeMode(1);\n$object = $serializer-\u003eunserialize($jsonData, $object);\n//Non-Strict unserialize mode\n$serializer-\u003esetStrictUnserializeMode(0);\n$object = $serializer-\u003eunserialize($jsonData, $object);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopensoft%2Fopensoftsimpleserializerbundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopensoft%2Fopensoftsimpleserializerbundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopensoft%2Fopensoftsimpleserializerbundle/lists"}