{"id":18062116,"url":"https://github.com/john-shaffer/php-clj","last_synced_at":"2025-04-11T15:04:24.614Z","repository":{"id":259860819,"uuid":"864164305","full_name":"john-shaffer/php-clj","owner":"john-shaffer","description":"Deserialize PHP into Clojure data structures and back again.","archived":false,"fork":false,"pushed_at":"2024-09-27T16:00:09.000Z","size":34,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-11T02:12:09.774Z","etag":null,"topics":["clojure","php","serialization"],"latest_commit_sha":null,"homepage":"https://clojars.org/org.clojars.john-shaffer/php-clj","language":"Clojure","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/john-shaffer.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-27T16:00:03.000Z","updated_at":"2024-09-27T18:35:38.000Z","dependencies_parsed_at":"2024-10-28T13:43:26.499Z","dependency_job_id":"69283da4-9280-4765-93cc-103e88bae56f","html_url":"https://github.com/john-shaffer/php-clj","commit_stats":null,"previous_names":["john-shaffer/php-clj"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/john-shaffer%2Fphp-clj","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/john-shaffer%2Fphp-clj/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/john-shaffer%2Fphp-clj/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/john-shaffer%2Fphp-clj/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/john-shaffer","download_url":"https://codeload.github.com/john-shaffer/php-clj/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248429061,"owners_count":21101780,"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":["clojure","php","serialization"],"created_at":"2024-10-31T05:05:43.590Z","updated_at":"2025-04-11T15:04:24.585Z","avatar_url":"https://github.com/john-shaffer.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# php-clj\n\n[![Clojars Project](https://img.shields.io/clojars/v/org.clojars.john-shaffer/php-clj.svg)](https://clojars.org/org.clojars.john-shaffer/php-clj)\n\n***This is a fork of [php-clj](https://github.com/mudge/php-clj) that has been updated for compatibility with newer versions of the [ordered](https://github.com/clj-commons/ordered) dependency. The tests have been updated to pass in Clojure 1.10.1. If you are getting an error like `clojure.lang.ExceptionInfo: Conflicting data-reader mapping {:url #object[java.net.URL 0x42039326 \"jar:file:/home/john/.m2/repository/org/flatland/ordered/1.5.7/ordered-1.5.7.jar!/data_readers.clj\"], :conflict ordered/set, :mappings {ordered/set #'ordered.set/into-ordered-set, ordered/map #'ordered.map/ordered-map}}` with the mainline php-clj, then this fork is what you need.***\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**: 1.3.0\n\n**Supported Clojure versions:** 1.10 or later\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/clj-commons/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\nAdd to deps.edn:\n\n```clojure\norg.clojars.john-shaffer/php-clj {:mvn/version \"1.3.0\"}\n```\n\nOr add to project.clj:\n\n```clojure\n[org.clojars.john-shaffer/php-clj \"1.3.0\"]\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%2Fjohn-shaffer%2Fphp-clj","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohn-shaffer%2Fphp-clj","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohn-shaffer%2Fphp-clj/lists"}