{"id":14986683,"url":"https://github.com/erasys/openapi-php","last_synced_at":"2025-04-11T20:31:50.089Z","repository":{"id":48418507,"uuid":"129788604","full_name":"erasys/openapi-php","owner":"erasys","description":"📚Swagger / Open API 3.0 builder and validation library for PHP that helps you write valid specs.","archived":false,"fork":false,"pushed_at":"2024-03-06T11:15:36.000Z","size":98,"stargazers_count":19,"open_issues_count":1,"forks_count":13,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-04-26T22:02:27.374Z","etag":null,"topics":["oai","oas","oasv3","openapi","openapi-spec","openapi3","swagger","swagger3"],"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/erasys.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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}},"created_at":"2018-04-16T18:32:26.000Z","updated_at":"2024-06-18T19:43:12.991Z","dependencies_parsed_at":"2022-08-21T11:50:44.641Z","dependency_job_id":"6e9cabbb-e669-4990-a95b-aebb0d70ad48","html_url":"https://github.com/erasys/openapi-php","commit_stats":{"total_commits":40,"total_committers":6,"mean_commits":6.666666666666667,"dds":"0.22499999999999998","last_synced_commit":"c03a8312cfc58ed38c7343265e36a9cb7140b634"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erasys%2Fopenapi-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erasys%2Fopenapi-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erasys%2Fopenapi-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erasys%2Fopenapi-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/erasys","download_url":"https://codeload.github.com/erasys/openapi-php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248476337,"owners_count":21110260,"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":["oai","oas","oasv3","openapi","openapi-spec","openapi3","swagger","swagger3"],"created_at":"2024-09-24T14:13:20.304Z","updated_at":"2025-04-11T20:31:45.078Z","avatar_url":"https://github.com/erasys.png","language":"PHP","readme":"# openapi-php\n\n[![Latest Version on Packagist][ico-version]][link-releases]\n[![Software License][ico-license]](LICENSE)\n[![Build Status][ico-travis]][link-travis]\n[![Coverage Status][ico-coverage]][link-coverage]\n[![Quality Score][ico-scrutinizer]][link-scrutinizer]\n[![Total Downloads][ico-downloads]][link-downloads]\n\nOpen API 3.0 builder and validation library for PHP that helps you write valid specs.\n\n[PSR-1]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md\n[PSR-2]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md\n[PSR-4]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md\n\n\nThis project is compliant with [PSR-1], [PSR-2] and [PSR-4].\nIf you notice compliance oversights, please send a patch via pull request.\n\n## Features\n\n- Fully documented object-oriented representation of the \n[Open API 3.0+](https://github.com/OAI/OpenAPI-Specification/tree/master/versions) specification with helper methods\nto write valid documents.\n- Supports Illuminate (Laravel) [`Jsonable`](https://github.com/illuminate/contracts/blob/v5.4.0/Support/Jsonable.php) \nand [`Arrayable`](https://github.com/illuminate/contracts/blob/v5.4.0/Support/Arrayable.php).\n- Generates an specification in plain PHP arrays, plain objects, JSON or YAML.\n- Validates Open API documents against the Open API 3.0.x JSON Schema.\n\n\n## Install\n\nVia Composer\n\n``` bash\n$ composer require erasys/openapi-php\n```\n\nVia Git\n\n``` bash\n$ git clone https://github.com/erasys/openapi-php.git\n```\n\n## Usage\n\nBasic example:\n\n```php\n\u003c?php\n\nuse erasys\\OpenApi\\Spec\\v3 as OASv3;\n\n$doc = new OASv3\\Document(\n    new OASv3\\Info('My API', '1.0.0', 'My API description'),\n    [\n        '/foo/bar' =\u003e new OASv3\\PathItem(\n            [\n                'get' =\u003e new OASv3\\Operation(\n                    [\n                        '200' =\u003e new OASv3\\Response('Successful response.'),\n                        'default' =\u003e new OASv3\\Response('Default error response.'),\n                    ]\n                ),\n            ]\n        ),\n    ]\n);\n\n$yaml = $doc-\u003etoYaml();\n$json = $doc-\u003etoJson();\n$arr  = $doc-\u003etoArray();\n$obj  = $doc-\u003etoObject();\n\n```\n\n## Testing\n\n``` bash\n$ composer test\n```\n\nor\n\n``` bash\n$ vendor/bin/phpunit\n$ vendor/bin/phpcs\n```\n\n## Contributing\n\nPlease see [CONTRIBUTING](https://github.com/erasys/openapi-php/blob/master/CONTRIBUTING.md) for details.\n\n## License\n\nThe MIT License (MIT).\nPlease see [License File](https://github.com/erasys/openapi-php/blob/master/LICENSE) for more information.\n\n\n[ico-version]: https://img.shields.io/packagist/v/erasys/openapi-php.svg?style=flat-square\n[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square\n[ico-travis]: https://img.shields.io/travis/erasys/openapi-php/master.svg?style=flat-square\n[ico-downloads]: https://img.shields.io/packagist/dt/erasys/openapi-php.svg?style=flat-square\n[ico-coverage]: https://img.shields.io/scrutinizer/coverage/g/erasys/openapi-php.svg?style=flat-square\n[ico-scrutinizer]: https://img.shields.io/scrutinizer/g/erasys/openapi-php.svg?style=flat-square\n[link-releases]: https://packagist.org/packages/erasys/openapi-php\n[link-travis]: https://travis-ci.org/erasys/openapi-php\n[link-downloads]: https://packagist.org/packages/erasys/openapi-php\n[link-coverage]: https://scrutinizer-ci.com/g/erasys/openapi-php/code-structure\n[link-scrutinizer]: https://scrutinizer-ci.com/g/erasys/openapi-php\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferasys%2Fopenapi-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferasys%2Fopenapi-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferasys%2Fopenapi-php/lists"}