{"id":14986670,"url":"https://github.com/apiboard/php-openapi","last_synced_at":"2025-04-11T21:31:10.992Z","repository":{"id":149512155,"uuid":"553826449","full_name":"Apiboard/php-openapi","owner":"Apiboard","description":"OpenAPI Specification parser for PHP 8. Supports both OAS 3.0 and 3.1.","archived":false,"fork":false,"pushed_at":"2024-02-21T20:56:09.000Z","size":316,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-25T18:45:26.255Z","etag":null,"topics":["openapi","openapi-spec","openapi-specification","openapi3","php8"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":false,"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/Apiboard.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}},"created_at":"2022-10-18T20:46:53.000Z","updated_at":"2024-07-23T13:49:26.000Z","dependencies_parsed_at":"2023-11-21T23:27:24.795Z","dependency_job_id":"dbba43d5-8234-4365-86bc-e66136f05284","html_url":"https://github.com/Apiboard/php-openapi","commit_stats":{"total_commits":181,"total_committers":5,"mean_commits":36.2,"dds":0.2817679558011049,"last_synced_commit":"0cadd1d72b21cbe279029e4c685a0b8651c45977"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Apiboard%2Fphp-openapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Apiboard%2Fphp-openapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Apiboard%2Fphp-openapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Apiboard%2Fphp-openapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Apiboard","download_url":"https://codeload.github.com/Apiboard/php-openapi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248482923,"owners_count":21111401,"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":["openapi","openapi-spec","openapi-specification","openapi3","php8"],"created_at":"2024-09-24T14:13:18.853Z","updated_at":"2025-04-11T21:31:10.574Z","avatar_url":"https://github.com/Apiboard.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP OpenAPI\n\nOpenAPI Specification parser for PHP 8. Supports both OAS 3.0 and 3.1.\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/vpre/apiboard/php-openapi.svg?style=flat-square)](https://packagist.org/packages/apiboard/php-openapi)\n![PHP from Packagist](https://img.shields.io/packagist/php-v/apiboard/php-openapi?style=flat-square)\n![CI](https://github.com/apiboard/php-openapi/workflows/CI/badge.svg?style=flat-square)\n\n## Features\n\n- Parse OpenAPI files into a PHP object to interact with in code\n- Validate OpenAPI files against the official JSON-schema descriptions\n- Resolve external and internal references\n\n## Installation\n\n```bash\ncomposer require apiboard/php-openapi\n```\n\n## Usage\n\nYou can interact with this library through the `OpenAPI::class` directly.\n\n```php\n$openAPI = new OpenAPI();\n```\nThis class optionally accepts an implementation of `Apiboard\\OpenAPI\\Contents\\Retriever::class` which will be used to retrieve the file contents. By default the local filesystem will be used to retrieve file contents.\n\n### Parse\n\nYou can parse the contents of a file by passing its path to `parse()`. This will attempt to retrieve the file's contents and resolve any external references.\n\nIt returns a PHP object that represents the OAS document structure that can be used in code.\n```php\n$document = $openAPI-\u003eparse('/path/to/my-oas.json');\n\n$document-\u003eopenapi(); // 3.1.0\n```\n\n### Validate\nYou can directly validate the contents of a file against the official OpenAPI JSON-schema descriptions. It returns an array of possible errors that occured during the validation.\n\n```php\n$errors = $openAPI-\u003evalidate('/path/to/my-oas.yaml');\n```\n\n\u003e ⚠️ Validation for OAS 3.1 does not check any JSON Schemas in your OpenAPI document because it allows you to use any JSON Schema dialect you choose!\n\n### Resolve\n\nYou can resolve external and internal references. It returns a PHP object with the resolved contents.\n\n```php\n$contents = $openAPI-\u003eresolve('/path/to/my-oas.json');\n\n$document = new Apiboard\\OpenAPI\\Structure\\Document($contents);\n```\nWhen resolving references the contents will be retrieved from the local fileystem by default. You can override the way file contents is retrieved by passing a custom class that implements the `Apiboard\\OpenAPI\\Contents\\Retriever` interface.\n\n```php\n\n$customRetriever = new MyCustomRetriever();\n$openAPI = new OpenAPI($customRetriever);\n\n$openAPI-\u003eresolve('/path/to/my-oas.json');\n```\n\nCircular references are resolved as an internal reference after recursing twice, this is to prevent infinite recursion.\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapiboard%2Fphp-openapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapiboard%2Fphp-openapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapiboard%2Fphp-openapi/lists"}