{"id":19124673,"url":"https://github.com/duncan3dc/serial","last_synced_at":"2025-06-19T04:03:17.375Z","repository":{"id":21835438,"uuid":"25158488","full_name":"duncan3dc/serial","owner":"duncan3dc","description":"A collection of PHP serialization helpers with a consistent interface for each.","archived":false,"fork":false,"pushed_at":"2021-07-24T16:50:41.000Z","size":51,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-08T22:21:37.300Z","etag":null,"topics":["json","php","serializer","yaml"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/duncan3dc.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-13T12:53:01.000Z","updated_at":"2021-07-24T16:50:42.000Z","dependencies_parsed_at":"2022-08-20T00:00:51.767Z","dependency_job_id":null,"html_url":"https://github.com/duncan3dc/serial","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/duncan3dc/serial","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duncan3dc%2Fserial","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duncan3dc%2Fserial/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duncan3dc%2Fserial/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duncan3dc%2Fserial/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/duncan3dc","download_url":"https://codeload.github.com/duncan3dc/serial/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duncan3dc%2Fserial/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260684095,"owners_count":23046098,"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":["json","php","serializer","yaml"],"created_at":"2024-11-09T05:29:51.005Z","updated_at":"2025-06-19T04:03:12.360Z","avatar_url":"https://github.com/duncan3dc.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"serial\n======\n\nA collection of PHP serialization helpers with a consistent interface for each.\n\n[![release](https://poser.pugx.org/duncan3dc/serial/version.svg)](https://packagist.org/packages/duncan3dc/serial)\n![build](https://github.com/duncan3dc/serial/workflows/buildcheck/badge.svg?branch=master)](https://github.com/duncan3dc/serial/actions?query=branch%3Amaster+workflow%3Abuildcheck)\n[![coverage](https://codecov.io/gh/duncan3dc/serial/graph/badge.svg)](https://codecov.io/gh/duncan3dc/serial)\n\n\nAvailable Classes\n=================\n\n* Json (using the native json_* functions)\n* Yaml (using the Symfony Yaml component)\n* Php (using the native serialize/unserialize functions)\n\n\nInterface\n=========\n\nAll serialization classes implement the interface [duncan3dc\\Serial\\SerialInterface](src/SerialInterface.php)\n\n\nExamples\n========\n\nConvert array data to string format\n```php\nuse duncan3dc\\Serial\\Json;\n$data = BusinessLogic::getDataAsArray();\n$json = Json::encode($data);\n```\n\nConvert string formatted data to an array\n```php\nuse duncan3dc\\Serial\\Yaml;\n$yaml = Api::getYamlResponse($request);\n$response = Yaml::decode($yaml);\n```\n\nConvient methods to serialize and store data on disk\n```php\nuse duncan3dc\\Serial\\Json;\n$filename = \"/tmp/file.json\";\n$data = BusinessLogic::getDataAsArray();\nJson::encodeToFile($filename, $data);\n```\n\nRetrieve previously stored data from disk\n```php\nuse duncan3dc\\Serial\\Json;\n$filename = \"/tmp/file.json\";\n$data = Json::decodeFromFile($filename);\n```\n\n\nArrayObject\n===========\n\nThe `decode()` and `decodeFromFile()` methods return a custom [ArrayObject](http://php.net/manual/en/class.arrayobject.php).\n\nIf you need a plain array you can get one like so:\n```php\n$array = Json::decode($jsonString)-\u003easArray();\n```\n\nThere are also helper methods to convert to any of the available serialization formats.\n```php\n$data = Json::decode($jsonString);\n$yaml = $data-\u003easYaml();\n$json = $data-\u003easJson();\n$php = $data-\u003easPhp();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fduncan3dc%2Fserial","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fduncan3dc%2Fserial","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fduncan3dc%2Fserial/lists"}