{"id":13579308,"url":"https://github.com/zircote/swagger-php","last_synced_at":"2026-04-19T23:09:14.519Z","repository":{"id":2816283,"uuid":"3817881","full_name":"zircote/swagger-php","owner":"zircote","description":"A php swagger annotation and parsing library","archived":false,"fork":false,"pushed_at":"2026-04-06T22:06:01.000Z","size":6508,"stargazers_count":5288,"open_issues_count":14,"forks_count":947,"subscribers_count":92,"default_branch":"master","last_synced_at":"2026-04-06T23:24:05.017Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://zircote.github.io/swagger-php/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zircote.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,"zenodo":null,"notice":"NOTICE","maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"zircote"}},"created_at":"2012-03-24T15:13:26.000Z","updated_at":"2026-04-06T21:46:13.000Z","dependencies_parsed_at":"2023-12-09T22:25:25.660Z","dependency_job_id":"aa2b95ba-bc3f-40bc-93ef-068bf95d9442","html_url":"https://github.com/zircote/swagger-php","commit_stats":{"total_commits":723,"total_committers":151,"mean_commits":4.788079470198675,"dds":0.5546334716459198,"last_synced_commit":"faf0bb4f95857bb59d95531e7b6efa7491946504"},"previous_names":[],"tags_count":200,"template":false,"template_full_name":null,"purl":"pkg:github/zircote/swagger-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zircote%2Fswagger-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zircote%2Fswagger-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zircote%2Fswagger-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zircote%2Fswagger-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zircote","download_url":"https://codeload.github.com/zircote/swagger-php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zircote%2Fswagger-php/sbom","scorecard":{"id":359713,"data":{"date":"2025-07-07","repo":{"name":"github.com/zircote/swagger-php","commit":"b8ba6bd99805c0ae09a38d1b26c1c92820509bd0"},"scorecard":{"version":"v5.2.1-18-gbb9c347d","commit":"bb9c347dff6349d986baab6578a46d68a5524c62"},"score":4.7,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":10,"reason":"14 commit(s) and 8 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#maintained"}},{"name":"Code-Review","score":3,"reason":"Found 10/30 approved changesets -- score normalized to 3","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-18T10:30:15.962Z","repository_id":2816283,"created_at":"2025-08-18T10:30:15.962Z","updated_at":"2025-08-18T10:30:15.962Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32025786,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"online","status_checked_at":"2026-04-19T02:00:07.110Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-08-01T15:01:38.239Z","updated_at":"2026-04-19T23:09:14.511Z","avatar_url":"https://github.com/zircote.png","language":"PHP","funding_links":["https://github.com/sponsors/zircote"],"categories":["PHP","Table of Contents","文档( Documentation )"],"sub_categories":["Documentation","Zend Framework 3","Library"],"readme":"[![Build Status](https://img.shields.io/github/actions/workflow/status/zircote/swagger-php/build.yml?branch=master)](https://github.com/zircote/swagger-php/actions?query=workflow:build)\n[![Total Downloads](https://img.shields.io/packagist/dt/zircote/swagger-php.svg)](https://packagist.org/packages/zircote/swagger-php)\n[![License](https://img.shields.io/badge/license-Apache2.0-blue.svg)](LICENSE)\n\n# swagger-php\n\nGenerate interactive [OpenAPI](https://www.openapis.org) documentation for your RESTful API\nusing [PHP attributes](https://www.php.net/manual/en/language.attributes.overview.php) (preferred) or\n[doctrine annotations](https://www.doctrine-project.org/projects/annotations.html) (requires additional\n`doctrine/annotations` library).\n\nSee the [documentation website](https://zircote.github.io/swagger-php/guide/using-attributes.html) for supported\nattributes and annotations.\n\n**Annotations are deprecated and may be removed in a future release of swagger-php.**\n\n## Features\n\n- Compatible with the OpenAPI **3.0**, **3.1** and **3.2** specification.\n- Extracts information from code and existing phpdoc comments.\n- Can be used programmatically or via command-line tool.\n- [Documentation site](https://zircote.github.io/swagger-php/) with a getting started guide.\n- Error reporting (with hints, context).\n- All metadata is configured via PHP attributes.\n\n## OpenAPI version support\n\n`swagger-php` allows to generate specs either for **OpenAPI 3.0.0**, **OpenAPI 3.1.0** and **OpenAPI 3.2.0**.\nBy default, the spec will be in version `3.0.0`. The command line option `--version` may be used to change to\nany other supported version.\n\nProgrammatically, the method `Generator::setVersion()` can be used to change the version.\n\n## Requirements\n\n`swagger-php` requires at least **PHP 8.2**.\n\n## Installation (with [Composer](https://getcomposer.org))\n\n```shell\ncomposer require zircote/swagger-php\n```\n\nFor cli usage from anywhere, install swagger-php globally and make sure to place the `~/.composer/vendor/bin` directory\nin your PATH so the `openapi` executable can be located by your system.\n\n```shell\ncomposer global require zircote/swagger-php\n```\n\n### doctrine/annotations\n\nAs of version `4.8` the [doctrine annotations](https://www.doctrine-project.org/projects/annotations.html) library **is\noptional** and **no longer installed by default**.\n\nIf your code uses doctrine annotations you will need to install that library manually:\n\n```shell\ncomposer require doctrine/annotations\n```\n\n## Usage\n\nUse OpenAPI attributes to add metadata to your classes, methods and other structural PHP elements.\n\n```php\n\nuse OpenApi\\Attributes as OAT;\n\n#[OAT\\Info(title: 'My First API', version: '0.1')]\nclass MyApi\n{\n    #[OAT\\Get(path: '/api/resource.json')]\n    #[OAT\\Response(response: '200', description: 'An example resource')]\n    public function getResource()\n    {\n        // ...\n    }\n}\n```\n\nVisit the [Documentation website](https://zircote.github.io/swagger-php/) for\nthe [Getting started guide](https://zircote.github.io/swagger-php/guide) or look at\nthe [examples directory](docs/examples) for more examples.\n\n### Usage from PHP\n\nGenerate always-up-to-date documentation.\n\n```php\n\u003c?php\nrequire(\"vendor/autoload.php\");\n$openapi = (new \\OpenApi\\Generator())-\u003egenerate(['/path/to/project']);\nheader('Content-Type: application/x-yaml');\necho $openapi-\u003etoYaml();\n```\n\nDocumentation of how to use the `Generator` class can be found in\nthe [Generator reference](https://zircote.github.io/swagger-php/reference/generator).\n\n### Usage from the Command Line Interface\n\nThe `openapi` command line interface can be used to generate the documentation to a static yaml/json file.\n\n```shell\n./vendor/bin/openapi --help\n```\n\n## Automatic type resolution\n\nAs of version 6, resolving of types is done using the `TypeInfoTypeResolver` class. It uses the `symfony/type-info`\nlibrary under the hood which allows handling of complext types.\n\nWith this change, `swagger-php` supports all available native type-hints and also complext generic type-hints via phpdoc\nblocks.\nThis simplifies the definition of schemas.\n\nFor example, the following two examples are now equivalent:\n\n```php\nclass MyClass\n{\n    #[OAT\\Property(items: new OAT\\Items(oneOf: [\n        new OAT\\Schema(type: SchemaOne::class),\n        new OAT\\Schema(type: SchemaTwo::class),\n    ]))]\n    public array $values;\n}\n```\n\n```php\nclass MyClass\n{\n    /**\n     * @var list\u003cSchemaOne|SchemaTwo\u003e\n     */\n    public array $values;\n}\n```\n\nIf this is not desired, the `LegacyTypeResolver` can be used to preserve the old behaviour of version 5.\nThe `LegacyTypeResolver` is deprecated and will be removed in a future release.\n\n## [Contributing](CONTRIBUTING.md)\n\n## More on OpenApi \u0026 Swagger\n\n- https://swagger.io\n- https://www.openapis.org\n- [OpenApi Documentation](https://swagger.io/docs/)\n- [OpenApi Specification](http://swagger.io/specification/)\n- [Related projects](docs/related-projects.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzircote%2Fswagger-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzircote%2Fswagger-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzircote%2Fswagger-php/lists"}