[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-8340":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":19,"rankGlobal":10,"rankLanguage":10,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":21,"hasPages":23,"topics":24,"createdAt":10,"pushedAt":10,"updatedAt":25,"readmeContent":26,"aiSummary":27,"trendingCount":16,"starSnapshotCount":16,"syncStatus":28,"lastSyncTime":29,"discoverSource":30},8340,"swagger-php","zircote\u002Fswagger-php","zircote","A php swagger annotation and parsing library","http:\u002F\u002Fzircote.github.io\u002Fswagger-php\u002F",null,"PHP",5299,939,92,14,0,1,10,39.92,"Apache License 2.0",false,"master",true,[],"2026-06-12 02:01:52","[![Build Status](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Factions\u002Fworkflow\u002Fstatus\u002Fzircote\u002Fswagger-php\u002Fbuild.yml?branch=master)](https:\u002F\u002Fgithub.com\u002Fzircote\u002Fswagger-php\u002Factions?query=workflow:build)\n[![Total Downloads](https:\u002F\u002Fimg.shields.io\u002Fpackagist\u002Fdt\u002Fzircote\u002Fswagger-php.svg)](https:\u002F\u002Fpackagist.org\u002Fpackages\u002Fzircote\u002Fswagger-php)\n[![License](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-Apache2.0-blue.svg)](LICENSE)\n\n# swagger-php\n\nGenerate interactive [OpenAPI](https:\u002F\u002Fwww.openapis.org) documentation for your RESTful API\nusing [PHP attributes](https:\u002F\u002Fwww.php.net\u002Fmanual\u002Fen\u002Flanguage.attributes.overview.php) (preferred) or\n[doctrine annotations](https:\u002F\u002Fwww.doctrine-project.org\u002Fprojects\u002Fannotations.html) (requires additional\n`doctrine\u002Fannotations` library).\n\nSee the [documentation website](https:\u002F\u002Fzircote.github.io\u002Fswagger-php\u002Fguide\u002Fusing-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:\u002F\u002Fzircote.github.io\u002Fswagger-php\u002F) 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:\u002F\u002Fgetcomposer.org))\n\n```shell\ncomposer require zircote\u002Fswagger-php\n```\n\nFor cli usage from anywhere, install swagger-php globally and make sure to place the `~\u002F.composer\u002Fvendor\u002Fbin` directory\nin your PATH so the `openapi` executable can be located by your system.\n\n```shell\ncomposer global require zircote\u002Fswagger-php\n```\n\n### doctrine\u002Fannotations\n\nAs of version `4.8` the [doctrine annotations](https:\u002F\u002Fwww.doctrine-project.org\u002Fprojects\u002Fannotations.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\u002Fannotations\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: '\u002Fapi\u002Fresource.json')]\n    #[OAT\\Response(response: '200', description: 'An example resource')]\n    public function getResource()\n    {\n        \u002F\u002F ...\n    }\n}\n```\n\nVisit the [Documentation website](https:\u002F\u002Fzircote.github.io\u002Fswagger-php\u002F) for\nthe [Getting started guide](https:\u002F\u002Fzircote.github.io\u002Fswagger-php\u002Fguide) or look at\nthe [examples directory](docs\u002Fexamples) for more examples.\n\n### Usage from PHP\n\nGenerate always-up-to-date documentation.\n\n```php\n\u003C?php\nrequire(\"vendor\u002Fautoload.php\");\n$openapi = (new \\OpenApi\\Generator())->generate(['\u002Fpath\u002Fto\u002Fproject']);\nheader('Content-Type: application\u002Fx-yaml');\necho $openapi->toYaml();\n```\n\nDocumentation of how to use the `Generator` class can be found in\nthe [Generator reference](https:\u002F\u002Fzircote.github.io\u002Fswagger-php\u002Freference\u002Fgenerator).\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\u002Fjson file.\n\n```shell\n.\u002Fvendor\u002Fbin\u002Fopenapi --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\u002Ftype-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    \u002F**\n     * @var list\u003CSchemaOne|SchemaTwo>\n     *\u002F\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 & Swagger\n\n- https:\u002F\u002Fswagger.io\n- https:\u002F\u002Fwww.openapis.org\n- [OpenApi Documentation](https:\u002F\u002Fswagger.io\u002Fdocs\u002F)\n- [OpenApi Specification](http:\u002F\u002Fswagger.io\u002Fspecification\u002F)\n- [Related projects](docs\u002Frelated-projects.md)\n","zircote\u002Fswagger-php 是一个用于生成 RESTful API 的交互式 OpenAPI 文档的 PHP 库。它支持使用 PHP 属性或 Doctrine 注解（需额外安装 `doctrine\u002Fannotations` 库）来为代码添加元数据，从而自动生成符合 OpenAPI 3.0、3.1 和 3.2 规范的文档。该库能够从现有代码和 phpdoc 注释中提取信息，并且既可以通过编程方式也可以通过命令行工具使用。此外，它还提供了详细的错误报告功能，帮助开发者快速定位问题。此项目适用于需要为其 API 提供清晰文档说明的 PHP 开发者，尤其是那些希望遵循最新 OpenAPI 标准的开发者。",2,"2026-06-11 03:17:27","top_language"]