{"id":29633611,"url":"https://github.com/ddddddo/ps2","last_synced_at":"2025-07-21T14:05:44.266Z","repository":{"id":297810943,"uuid":"997887650","full_name":"ddddddO/ps2","owner":"ddddddO","description":"🎮 phP Serialize() To {JSON|YAML|TOML}","archived":false,"fork":false,"pushed_at":"2025-07-06T10:58:16.000Z","size":4177,"stargazers_count":4,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-14T06:34:45.575Z","etag":null,"topics":["converter","deserializer","json","php","toml","wasm","yaml"],"latest_commit_sha":null,"homepage":"https://ddddddo.github.io/ps2/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ddddddO.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-07T12:07:23.000Z","updated_at":"2025-07-06T10:58:20.000Z","dependencies_parsed_at":"2025-06-07T16:43:40.937Z","dependency_job_id":"f038b2ad-0747-4129-a9af-5bb431ae836d","html_url":"https://github.com/ddddddO/ps2","commit_stats":null,"previous_names":["ddddddo/ps2"],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/ddddddO/ps2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddddddO%2Fps2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddddddO%2Fps2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddddddO%2Fps2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddddddO%2Fps2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ddddddO","download_url":"https://codeload.github.com/ddddddO/ps2/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddddddO%2Fps2/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266315763,"owners_count":23909802,"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","status":"online","status_checked_at":"2025-07-21T11:47:31.412Z","response_time":64,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["converter","deserializer","json","php","toml","wasm","yaml"],"created_at":"2025-07-21T14:05:43.449Z","updated_at":"2025-07-21T14:05:44.258Z","avatar_url":"https://github.com/ddddddO.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🎮 PS2\n\n[![GitHub release](https://img.shields.io/github/release/ddddddO/ps2.svg?label=Release\u0026color=darkcyan)](https://github.com/ddddddO/ps2/releases)\n[![codecov](https://codecov.io/gh/ddddddO/ps2/graph/badge.svg?token=6E0G81K2H0)](https://codecov.io/gh/ddddddO/ps2)\n[![ci](https://github.com/ddddddO/ps2/actions/workflows/ci.yaml/badge.svg)](https://github.com/ddddddO/ps2/actions/workflows/ci.yaml)\n\n\n**phP Serialize() To {JSON|YAML|TOML}**\n\nWeb and CLI tool are available!\u003c/br\u003e\n\n\u003e [!WARNING]\n\u003e Use it for easy human checking.\n\nConverts data serialized by the PHP serialize function into some format (JSON or YAML or TOML for now).\u003c/br\u003e\nThis may be useful if you want to convert the payload string stored in the Laravel job queue 👍 \u003c/br\u003e\nIf you find a bug or have a request, please create issue or Pull Request!\n\nWeb 👉 https://ddddddo.github.io/ps2/ \u003c/br\u003e\nConversion can be done offline as it is processed in Wasm.\n\n## Supported Types\n|-|Type|Note|\n|--|--|--|\n|⭕|`a:5;`||\n|⭕|`s:4:\"xxxx\";`||\n|⭕|`E:4:\"xxxx\";`||\n|⭕|`i:555`||\n|⭕|`d:3.14`||\n|⭕|`b:0` / `b:1`||\n|⭕|`N`||\n|⭕|`r:1` / `R:1`| filled with `[[PHP_REFERENCE_DATA: \u003cactual referenced unserialized data\u003e]]`\u003cbr\u003eor `[[MAYBE_PHP_SELF_REFERENCE]]` |\n|⭕|`O:3:\"Obj\":2:{...}`||\n|⭕|`C:3:\"Csm\":2:{...}`||\n\n## Install\n\n### Homebrew\n\n```console\nbrew install ddddddO/tap/ps2\n```\n\n### Go\n```console\ngo install github.com/ddddddO/ps2/cmd/ps2@latest\n```\n\n## Usage\n\nFormat:\n```console\n$ ps2 \u003c\u003c\u003c '\u003c Data serialized by PHP serialize function \u003e'\n```\n\n- Use `\u003c\u003c\u003c` or `printf` to pass serialized data to stdin, since using echo as in `echo 'O:13:\"App\\UpdateJob....' | ps2` may cut off the `\\U` part.\n\nExample serialized data:\n```console\nO:13:\"MySimpleClass\":17:{s:10:\"publicProp\";s:16:\"Top Level Object\";s:26:\"MySimpleClassprivateProp\";i:999;s:16:\"*protectedProp\";a:3:{s:10:\"assoc_key1\";s:12:\"assoc_value1\";s:10:\"assoc_key2\";i:789;s:17:\"deep_nested_array\";a:2:{s:9:\"sub_key_x\";s:11:\"sub_value_x\";s:9:\"sub_key_y\";d:12.34;}}s:6:\"parent\";N;s:15:\"nestedArrayData\";a:5:{i:0;s:6:\"Item A\";i:1;s:6:\"Item B\";i:2;s:6:\"Item C\";i:3;i:10;i:4;b:0;}s:16:\"sharedStringRef1\";s:33:\"共有される文字列データ\";s:16:\"sharedStringRef2\";R:17;s:16:\"sharedObjectRef1\";O:13:\"MySimpleClass\":6:{s:10:\"publicProp\";s:24:\"共通オブジェクト\";s:26:\"MySimpleClassprivateProp\";i:500;s:16:\"*protectedProp\";a:1:{s:6:\"shared\";b:1;}s:6:\"parent\";N;s:15:\"nestedArrayData\";a:0:{}s:9:\"nullValue\";N;}s:16:\"sharedObjectRef2\";r:18;s:21:\"customSerializableObj\";O:20:\"MyCustomSerializable\":2:{s:1:\"s\";s:36:\"オブジェクト内のカスタム\";s:1:\"n\";i:777;}s:12:\"userRoleEnum\";E:15:\"UserRole:Editor\";s:10:\"statusEnum\";E:13:\"Status:Active\";s:9:\"nullValue\";N;s:11:\"booleanTrue\";b:1;s:10:\"floatValue\";d:45.67;s:12:\"integerValue\";i:123;s:14:\"japaneseString\";s:36:\"これは日本語の文字列です\";}\n```\n\nExample execution:\n\n```console\n$ ps2 \u003c\u003c\u003c 'O:13:\"MySimpleClass\":17:{s:10:\"publicProp\";s:16:\"Top Level Object\";s:26:\"MySimpleClassprivateProp\";i:999;s:16:\"*protectedProp\";a:3:{s:10:\"assoc_key1\";s:12:\"assoc_value1\";s:10:\"assoc_key2\";i:789;s:17:\"deep_nested_array\";a:2:{s:9:\"sub_key_x\";s:11:\"sub_value_x\";s:9:\"sub_key_y\";d:12.34;}}s:6:\"parent\";N;s:15:\"nestedArrayData\";a:5:{i:0;s:6:\"Item A\";i:1;s:6:\"Item B\";i:2;s:6:\"Item C\";i:3;i:10;i:4;b:0;}s:16:\"sharedStringRef1\";s:33:\"共有される文字列データ\";s:16:\"sharedStringRef2\";R:17;s:16:\"sharedObjectRef1\";O:13:\"MySimpleClass\":6:{s:10:\"publicProp\";s:24:\"共通オブジェクト\";s:26:\"MySimpleClassprivateProp\";i:500;s:16:\"*protectedProp\";a:1:{s:6:\"shared\";b:1;}s:6:\"parent\";N;s:15:\"nestedArrayData\";a:0:{}s:9:\"nullValue\";N;}s:16:\"sharedObjectRef2\";r:18;s:21:\"customSerializableObj\";O:20:\"MyCustomSerializable\":2:{s:1:\"s\";s:36:\"オブジェクト内のカスタム\";s:1:\"n\";i:777;}s:12:\"userRoleEnum\";E:15:\"UserRole:Editor\";s:10:\"statusEnum\";E:13:\"Status:Active\";s:9:\"nullValue\";N;s:11:\"booleanTrue\";b:1;s:10:\"floatValue\";d:45.67;s:12:\"integerValue\";i:123;s:14:\"japaneseString\";s:36:\"これは日本語の文字列です\";}'\n{\n  \"*protectedProp\": {\n    \"assoc_key1\": \"assoc_value1\",\n    \"assoc_key2\": 789,\n    \"deep_nested_array\": {\n      \"sub_key_x\": \"sub_value_x\",\n      \"sub_key_y\": 12.34\n    }\n  },\n  \"MySimpleClassprivateProp\": 999,\n  \"__class_name\": \"MySimpleClass\",\n  \"booleanTrue\": true,\n  \"customSerializableObj\": {\n    \"__class_name\": \"MyCustomSerializable\",\n    \"n\": 777,\n    \"s\": \"オブジェクト内のカスタム\"\n  },\n  \"floatValue\": 45.67,\n  \"integerValue\": 123,\n  \"japaneseString\": \"これは日本語の文字列です\",\n  \"nestedArrayData\": [\n    \"Item A\",\n    \"Item B\",\n    \"Item C\",\n    10,\n    false\n  ],\n  \"nullValue\": null,\n  \"parent\": null,\n  \"publicProp\": \"Top Level Object\",\n  \"sharedObjectRef1\": {\n    \"*protectedProp\": {\n      \"shared\": true\n    },\n    \"MySimpleClassprivateProp\": 500,\n    \"__class_name\": \"MySimpleClass\",\n    \"nestedArrayData\": [],\n    \"nullValue\": null,\n    \"parent\": null,\n    \"publicProp\": \"共通オブジェクト\"\n  },\n  \"sharedObjectRef2\": \"[[PHP_REFERENCE_DATA: map[*protectedProp:map[shared:true] MySimpleClassprivateProp:500 __class_name:MySimpleClass nestedArrayData:map[] nullValue:\u003cnil\u003e parent:\u003cnil\u003e publicProp:共通オブジェクト]]]\",\n  \"sharedStringRef1\": \"共有される文字列データ\",\n  \"sharedStringRef2\": \"[[PHP_REFERENCE_DATA: 共有される文字列データ]]\",\n  \"statusEnum\": \"Status:Active\",\n  \"userRoleEnum\": \"UserRole:Editor\"\n}\n$\n```\n\n### Output Types\n- `--json`\n  - Default. Convert to JSON.\n- `--yaml`\n  - Convert to YAML.\n- `--toml`\n  - Convert to TOML.\n\n## Related tool\n- **[PHP Serialized Object viewer](https://github.com/haradakunihiko/intellij-plugin-php-serialized-object-viewer)**\n    - If you are using IntelliJ IDEA / PhpStorm, please try this plugin!\n\n## Memo\n\n- The first version of this tool was generated by `Gemini 2.5 Flash`.\n    ```\n    phpのserialize関数でシリアライズされた文字列（元のデータは、ネストした連想配列と、配列と、適当なクラスのオブジェクトを持つ）から、astを生成するgoプログラムを教えてください。\n    ```\n\n    - 一発で動かない \u0026 微調整の必要があったため手を入れている\n      - 継続して手を入れ続けている\n    - 生成されたコードは「Go言語でつくるインタプリタ」の内容にかなり似ている\n\n- PHP serialize()\n    - https://www.php.net/manual/ja/function.serialize.php\n\n- This tool has been verified to work with serialized data generated by PHP 7.4.33.\n\n- [Reddit: r/PHP](https://www.reddit.com/r/PHP/comments/1l61qw7/github_ddddddops2_tool_to_convert_from_serialized/?utm_source=share\u0026utm_medium=web3x\u0026utm_name=web3xcss\u0026utm_term=1\u0026utm_content=share_button)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fddddddo%2Fps2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fddddddo%2Fps2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fddddddo%2Fps2/lists"}