{"id":13616775,"url":"https://github.com/dunglas/php-to-json-schema","last_synced_at":"2025-04-14T03:31:32.917Z","repository":{"id":56973278,"uuid":"49432601","full_name":"dunglas/php-to-json-schema","owner":"dunglas","description":"Creates a JSON Schema from a PHP class","archived":true,"fork":false,"pushed_at":"2022-01-10T20:41:18.000Z","size":9,"stargazers_count":32,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-17T23:33:50.855Z","etag":null,"topics":["json","json-schema","php"],"latest_commit_sha":null,"homepage":"https://dunglas.fr","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/dunglas.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}},"created_at":"2016-01-11T14:46:51.000Z","updated_at":"2024-10-05T15:46:55.000Z","dependencies_parsed_at":"2022-08-21T10:20:49.888Z","dependency_job_id":null,"html_url":"https://github.com/dunglas/php-to-json-schema","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dunglas%2Fphp-to-json-schema","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dunglas%2Fphp-to-json-schema/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dunglas%2Fphp-to-json-schema/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dunglas%2Fphp-to-json-schema/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dunglas","download_url":"https://codeload.github.com/dunglas/php-to-json-schema/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248815541,"owners_count":21165942,"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","json-schema","php"],"created_at":"2024-08-01T20:01:33.173Z","updated_at":"2025-04-14T03:31:27.908Z","avatar_url":"https://github.com/dunglas.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"# PHP to JSON Schema\n\n**This library is deprecated, use [API Platform JSON Schema](https://api-platform.com/docs/core/json-schema/) instead.** \n\nCreates a JSON Schema from a PHP entity. Useful to ensure that a given JSON document will\nbe deserialized properly in an object graph.\n\n[![Build Status](https://travis-ci.org/dunglas/php-to-json-schema.svg)](https://travis-ci.org/dunglas/php-to-json-schema)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/dunglas/php-to-json-schema/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/dunglas/php-to-json-schema/?branch=master)\n[![SensioLabsInsight](https://insight.sensiolabs.com/projects/315bcf00-2a7d-4185-9290-c02c67c731d7/mini.png)](https://insight.sensiolabs.com/projects/315bcf00-2a7d-4185-9290-c02c67c731d7)\n\n## Installation\n\nUse [https://getcomposer.org](Composer) to install the library:\n\n```\ncomposer require dunglas/php-to-json-schema\n```\n\n## Usage\n\n```php\nuse Dunglas\\PhpToJsonSchema\\Generator;\nuse Symfony\\Component\\PropertyInfo\\Extractor\\ReflectionExtractor;\nuse Symfony\\Component\\PropertyInfo\\PropertyInfoExtractor;\n\nclass MyClass\n{\n    private $foo;\n    private $bar;\n\n    public function setFoo(string $foo)\n    {\n        $this-\u003efoo = $foo;\n    }\n\n    public function setBar(float $bar = null)\n    {\n        $this-\u003ebar = $bar;\n    }\n\n    // ...\n}\n\n\n$reflectionExtractor = new ReflectionExtractor();\n$propertyInfoExtractor = new PropertyInfoExtractor([$reflectionExtractor], [$reflectionExtractor], [], [$reflectionExtractor]);\n\n$generator = new Generator($propertyInfoExtractor);\necho json_encode($generator-\u003egenerate(MyClass::class));\n```\n\n## Credits\n\nCreated by [Kévin Dunglas](https://dunglas.fr).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdunglas%2Fphp-to-json-schema","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdunglas%2Fphp-to-json-schema","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdunglas%2Fphp-to-json-schema/lists"}