{"id":20842801,"url":"https://github.com/mudge/php-clj","last_synced_at":"2025-05-08T22:41:54.123Z","repository":{"id":12164320,"uuid":"14760961","full_name":"mudge/php-clj","owner":"mudge","description":"Deserialize PHP into Clojure data structures and back again.","archived":false,"fork":false,"pushed_at":"2018-06-20T19:27:06.000Z","size":280,"stargazers_count":8,"open_issues_count":2,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-08T18:53:39.705Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://clojars.org/php-clj","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"PrideChung/FontAwesomeKit","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mudge.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":"2013-11-27T22:40:49.000Z","updated_at":"2021-10-17T20:20:10.000Z","dependencies_parsed_at":"2022-08-07T06:16:46.597Z","dependency_job_id":null,"html_url":"https://github.com/mudge/php-clj","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mudge%2Fphp-clj","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mudge%2Fphp-clj/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mudge%2Fphp-clj/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mudge%2Fphp-clj/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mudge","download_url":"https://codeload.github.com/mudge/php-clj/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253160727,"owners_count":21863624,"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-18T01:25:31.696Z","updated_at":"2025-05-08T22:41:54.105Z","avatar_url":"https://github.com/mudge.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# php-clj [![Build Status](https://travis-ci.org/mudge/php-clj.png?branch=master)](https://travis-ci.org/mudge/php-clj)\n\nA Clojure library to deserialize PHP as generated by\n[`serialize`](http://php.net/manual/en/function.serialize.php) into Clojure\ndata structures and vice versa.\n\n**Current version**: 0.4.1  \n**Supported Clojure versions:** 1.4, 1.5, 1.5.1\n\n## Usage\n\n```clojure\n(ns foo.bar\n  (:require [php_clj.core :refer [php-\u003eclj clj-\u003ephp]]))\n\n(php-\u003eclj \"s:18:\\\"Café Scientifique\\\";\")\n;; =\u003e \"Café Scientifique\"\n\n(php-\u003eclj \"i:1337;\")\n;; =\u003e 1337\n\n(php-\u003eclj \"a:2:{s:4:\\\"Wöo\\\";a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}s:3:\\\"Bar\\\";b:0;}\")\n;; =\u003e #ordered/map ([\"Wöo\" [1 2 3]] [\"Bar\" false])\n\n(clj-\u003ephp \"Café\")\n;; =\u003e \"s:5:\\\"Café\\\";\"\n\n(clj-\u003ephp {\"name\" \"Bob\"})\n;; =\u003e \"a:1:{s:4:\\\"name\\\";s:3:\\\"Bob\\\";}\"\n```\n\n## A Note on PHP Arrays\n\nAs [PHP's Arrays](http://www.php.net/manual/en/language.types.array.php) are\nactually ordered maps, converting an array such as:\n\n```php\narray(\n    \"name\" =\u003e \"Bob\",\n    \"age\" =\u003e 42\n)\n```\n\nWill result in an [ordered\nmap](https://github.com/flatland/ordered) equivalent to the following:\n\n```clojure\n{\"name\" \"Bob\", \"age\" 42}\n```\n\nNote that Clojure's standard map implementation does not retain\ninsertion order (and [ArrayMaps are only suitable for \"very small\nmaps\"](http://clojure.org/data_structures#Data%20Structures-ArrayMaps)) hence\nthe use of the `ordered-map` type.\n\nArrays with consecutive indices starting at 0 such as\n\n```php\narray(\n    0 =\u003e \"a\",\n    1 =\u003e \"b\",\n    2 =\u003e \"c\"\n)\n```\n\nWill be converted into vectors like so:\n\n```clojure\n[\"a\" \"b\" \"c\"]\n```\n\n## Installation\n\nphp-clj is available on [Clojars](https://clojars.org/php-clj), add the\nfollowing to your [Leiningen](https://github.com/technomancy/leiningen)\ndependencies:\n\n```clojure\n[php-clj \"0.4.1\"]\n```\n\n## References\n\n* [Arto Bendiken's `php-s11n`](http://wiki.call-cc.org/eggref/4/php-s11n);\n* [Brad Koch's Stack Overflow discussion \"Parsing serialized PHP data with BNF\n  using\n  Instaparse\"](http://stackoverflow.com/questions/18518499/parsing-serialized-php-data-with-bnf-using-instaparse).\n\n## License\n\nCopyright © 2014 Paul Mucur.\n\nDistributed under the [Eclipse Public\nLicense](http://www.eclipse.org/legal/epl-v10.html).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmudge%2Fphp-clj","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmudge%2Fphp-clj","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmudge%2Fphp-clj/lists"}