{"id":22330877,"url":"https://github.com/flavioheleno/jay","last_synced_at":"2025-07-15T06:41:15.493Z","repository":{"id":124005389,"uuid":"610847722","full_name":"flavioheleno/jay","owner":"flavioheleno","description":"Jay is a thin wrapper for json \u0026 simdjson, allowing the fastest available json decoder to be used in a transparent way.","archived":false,"fork":false,"pushed_at":"2025-06-16T23:20:09.000Z","size":30,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-17T00:19:00.186Z","etag":null,"topics":["json","simdjson"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flavioheleno.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":"2023-03-07T15:49:27.000Z","updated_at":"2025-06-16T23:20:12.000Z","dependencies_parsed_at":"2025-01-31T08:32:31.676Z","dependency_job_id":"a12a2e9c-7696-446d-915b-dd5c4e188bc1","html_url":"https://github.com/flavioheleno/jay","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/flavioheleno/jay","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flavioheleno%2Fjay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flavioheleno%2Fjay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flavioheleno%2Fjay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flavioheleno%2Fjay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flavioheleno","download_url":"https://codeload.github.com/flavioheleno/jay/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flavioheleno%2Fjay/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265414706,"owners_count":23761056,"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","simdjson"],"created_at":"2024-12-04T04:08:27.189Z","updated_at":"2025-07-15T06:41:15.478Z","avatar_url":"https://github.com/flavioheleno.png","language":"PHP","readme":"# Jay\n\nJay is a thin wrapper for json \u0026 simdjson, allowing the fastest available json decoder to be used in a transparent way.\n\nUnder the hood, **Jay** will pick [simdjson](https://github.com/simdjson/simdjson) if available and the json encoded\nstring is up to 4GiB (4.294.967.295 bytes), otherwise it will fallback to PHP's JSON Core Extension.\n\n## Extension support\n\nThis library should work with either option below:\n\n* [crazyxman/simdjson_php](https://github.com/crazyxman/simdjson_php) - Read only support\n* [JakubOnderka/simdjson_php](https://github.com/JakubOnderka/simdjson_php) - Read and write support\n\n## Installation\n\nTo use Jay, simple run:\n\n```bash\ncomposer require flavioheleno/jay\n```\n\n## Usage\n\nThis library usage is straightforward.\n\n```php\n$jsonEncoded = '{\"a\":\"b\",\"c\":true,\"d\":10}';\n\n// before\n$phpArray = json_decode($jsonEncoded, true);\n\n// after\n$phpArray = Jay\\Json::fromString($jsonEncoded, true);\n```\n\n```php\n$phpArray = ['a' =\u003e 'b', 'c' =\u003e true, 'd' =\u003e 10];\n\n// before\n$jsonEncoded = json_encode($phpArray);\n\n// after\n$jsonEncoded = Jay\\Json::toString($phpArray);\n```\n\n```php\n// before\n$jsonEncoded = file_get_contents('path/to/file.json');\n$phpArray = json_decode($jsonEncoded, true);\n\n// after\n$phpArray = Jay\\Json::fromFile('path/to/file.json', true);\n```\n\n```php\n$phpArray = ['a' =\u003e 'b', 'c' =\u003e true, 'd' =\u003e 10];\n\n// before\n$jsonEncoded = json_encode($phpArray);\nfile_put_contents('path/to/file.json', $jsonEncoded);\n\n// after\nJay\\Json::toFile('path/to/file.json', $phpArray);\n```\n\n## API\n\n```php\n/**\n * @param string $filename   Name of the file to read.\n * @param bool $associative  When true, JSON objects will be returned as associative arrays; when false, JSON objects\n *                           will be returned as an instance of stdClass\n * @param int\u003c1, max\u003e $depth Maximum nesting depth of the structure being decoded. The value must be greater than 0,\n *                           and less than or equal to 2.147.483.647\n *\n * @return mixed Returns the value encoded in JSON as an appropriate PHP type; unquoted values true, false and null\n *               are returned as true, false and null respectively\n *\n * @throws InvalidArgumentException If the $filename argument is not a file, is not readable, if the JSON cannot be\n *                                  decoded or if the encoded data is deeper than the nesting limit.\n * @throws RuntimeException         If the contents of $filename cannot be read.\n */\nJay\\Json::fromFile(\n  string $filename,\n  bool $associative = false,\n  int $depth = 512\n): mixed;\n\n/**\n * @param string $filename   Name of the file to write.\n * @param mixed $value       The value being encoded. Can be any type except a resource. All string data must be UTF-8\n *                           encoded.\n * @param int $flags         Bitmask consisting of JSON_FORCE_OBJECT, JSON_HEX_QUOT, JSON_HEX_TAG, JSON_HEX_AMP,\n *                           JSON_HEX_APOS, JSON_INVALID_UTF8_IGNORE, JSON_INVALID_UTF8_SUBSTITUTE,\n *                           JSON_NUMERIC_CHECK, JSON_PARTIAL_OUTPUT_ON_ERROR, JSON_PRESERVE_ZERO_FRACTION,\n *                           JSON_PRETTY_PRINT, JSON_UNESCAPED_LINE_TERMINATORS, JSON_UNESCAPED_SLASHES,\n *                           JSON_UNESCAPED_UNICODE, JSON_THROW_ON_ERROR.\n * @param int\u003c1, max\u003e $depth Maximum nesting depth of the structure being encoded. The value must be greater than 0,\n *                           and less than or equal to 2.147.483.647\n *\n * @return int|false The number of bytes that were written to the file, or false on failure.\n *\n * @throws InvalidArgumentException If the $filename argument is not a writable file or if the JSON cannot be encoded\n *                                  or if the decoded data is deeper than the nesting limit.\n * @throws RuntimeException         If the encoded JSON cannot be write to $filename.\n */\nJay\\Json::toFile(\n  string $filename,\n  mixed $value,\n  int $flags = 0,\n  int $depth = 512\n): int|false;\n\n/**\n * @param string|Stringable $contents The JSON string being decoded; this function only works with UTF-8 encoded\n *                                    strings.\n * @param bool $associative           When true, JSON objects will be returned as associative arrays; when false,\n *                                    JSON objects will be returned as an instance of stdClass\n * @param int\u003c1, max\u003e $depth          Maximum nesting depth of the structure being decoded. The value must be greater\n *                                    than 0, and less than or equal to 2.147.483.647\n *\n * @return mixed Returns the value encoded in JSON as an appropriate PHP type; unquoted values true, false and null\n *               are returned as true, false and null respectively\n *\n * @throws InvalidArgumentException If the JSON cannot be decoded or if the encoded data is deeper than the nesting\n *                                  limit.\n */\nJay\\Json::fromString(\n  string|Stringable $contents,\n  bool $associative = false,\n  int $depth = 512\n): mixed;\n\n/**\n * @param mixed $value       The value being encoded. Can be any type except a resource. All string data must be UTF-8\n *                           encoded.\n * @param int $flags         Bitmask consisting of JSON_FORCE_OBJECT, JSON_HEX_QUOT, JSON_HEX_TAG, JSON_HEX_AMP,\n *                           JSON_HEX_APOS, JSON_INVALID_UTF8_IGNORE, JSON_INVALID_UTF8_SUBSTITUTE,\n *                           JSON_NUMERIC_CHECK, JSON_PARTIAL_OUTPUT_ON_ERROR, JSON_PRESERVE_ZERO_FRACTION,\n *                           JSON_PRETTY_PRINT, JSON_UNESCAPED_LINE_TERMINATORS, JSON_UNESCAPED_SLASHES,\n *                           JSON_UNESCAPED_UNICODE, JSON_THROW_ON_ERROR.\n * @param int\u003c1, max\u003e $depth Maximum nesting depth of the structure being encoded. The value must be greater than 0,\n *                           and less than or equal to 2.147.483.647\n *\n * @return string A JSON encoded string.\n *\n * @throws InvalidArgumentException If the JSON cannot be encoded or if the decoded data is deeper than the nesting\n *                                  limit.\n */\nJay\\Json::toString(\n  mixed $value,\n  int $flags = 0,\n  int $depth = 512\n): string;\n```\n\n## License\n\nThis library is licensed under the [MIT License](LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflavioheleno%2Fjay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflavioheleno%2Fjay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflavioheleno%2Fjay/lists"}