{"id":23108189,"url":"https://github.com/genxoft/php-swagger-module","last_synced_at":"2025-08-16T17:32:27.121Z","repository":{"id":46136196,"uuid":"515048030","full_name":"genxoft/php-swagger-module","owner":"genxoft","description":"Swagger PHP module adapted for Mezzio/Laminas.","archived":false,"fork":false,"pushed_at":"2022-07-18T15:52:31.000Z","size":2218,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-09-17T08:26:52.534Z","etag":null,"topics":["laminas","mezzio","swagger","swagger-php","swagger-ui"],"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/genxoft.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-18T05:35:27.000Z","updated_at":"2024-02-17T14:13:57.000Z","dependencies_parsed_at":"2022-09-01T04:10:39.629Z","dependency_job_id":null,"html_url":"https://github.com/genxoft/php-swagger-module","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/genxoft%2Fphp-swagger-module","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/genxoft%2Fphp-swagger-module/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/genxoft%2Fphp-swagger-module/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/genxoft%2Fphp-swagger-module/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/genxoft","download_url":"https://codeload.github.com/genxoft/php-swagger-module/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230047165,"owners_count":18164575,"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":["laminas","mezzio","swagger","swagger-php","swagger-ui"],"created_at":"2024-12-17T01:17:41.950Z","updated_at":"2024-12-17T01:17:42.571Z","avatar_url":"https://github.com/genxoft.png","language":"PHP","funding_links":["https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=2PURUX2SHUD9E"],"categories":[],"sub_categories":[],"readme":"# Swagger PHP module\n\n## Description\n\nSwagger PHP module adapted for Mezzio/Laminas.\n\n## Requirements\n\n- PHP \u003e7.4\n- Mezzio\\Template\\TemplateRendererInterface\n\n## Installation\n\n\nThe preferred way to install this wrapper is through [composer](http://getcomposer.org/download/).\n\n```bash\nphp composer.phar require genxoft/php-swagger-module\n```\n\nor\n\n```bash\ncomposer require genxoft/php-swagger-module\n```\n\nor add to the require section of `composer.json`\n\n```\n\"genxoft/php-swagger-module\" : \"*\"\n```\n\n## Setup\n\nAfter installation of the package, you need to complete the following steps to use PHP Swagger module:\n\n1. Add ```\\Genxoft\\SwaggerPhpModule\\ConfigProvider::class``` to your config aggregator\n2. Add and customize (if necessary) configuration (add file ```php-swagger.global.php``` into ```config/autoload```)\n```php\n\u003c?php\nreturn [\n    'swagger_php' =\u003e [\n        'scanDirs' =\u003e [\n            __DIR__ . '/module'\n        ],\n        'jsonUrl' =\u003e '/api-oas-docs/json',\n    ],\n    'routes' =\u003e [\n        'swagger_php.route.json' =\u003e [\n            'path' =\u003e '/api-oas-docs/json',\n            'middleware' =\u003e [\n                \\Genxoft\\SwaggerPhpModule\\Handler\\JsonAction::class,\n            ],\n            'allowed_methods' =\u003e ['GET'],\n        ],\n        'swagger_php.route.ui' =\u003e [\n            'path' =\u003e '/api-oas-docs/ui',\n            'middleware' =\u003e [\n                \\Genxoft\\SwaggerPhpModule\\Handler\\UiAction::class,\n            ],\n            'allowed_methods' =\u003e ['GET'],\n        ],\n    ],\n];\n```\n\n## Open Api Swagger 3 example annotation\n\nApi server description\n\n```php\n/**\n * @OA\\Info(\n *   version=\"1.0\",\n *   title=\"Application API\",\n *   description=\"Server - Mobile app API\",\n *   @OA\\Contact(\n *     name=\"John Smith\",\n *     email=\"john@example.com\",\n *   ),\n * ),\n * @OA\\Server(\n *   url=\"https://example.com/api\",\n *   description=\"main server\",\n * )\n * @OA\\Server(\n *   url=\"https://dev.example.com/api\",\n *   description=\"dev server\",\n * )\n */\n...\n ```\n\nHandler annotation\n\n```php\n/**\n * @OA\\Get(path=\"/\",\n *   summary=\"Handshake\",\n *   tags={\"handshake\"},\n *   @OA\\Parameter(\n *     name=\"access-token\",\n *     in=\"header\",\n *     required=false,\n *     @OA\\Schema(\n *       type=\"string\"\n *     )\n *   ),\n *   @OA\\Response(\n *     response=200,\n *     description=\"Returns Hello object\",\n *     @OA\\MediaType(\n *         mediaType=\"application/json\",\n *         @OA\\Schema(ref=\"#/components/schemas/Hello\"),\n *     ),\n *   ),\n * )\n */\nclass HelloHandler implements RequestHandlerInterface\n{\n...\n```\nModel annotation\n```php\n/**\n *@OA\\Schema(\n *  schema=\"Hello\",\n *  @OA\\Property(\n *     property=\"message\",\n *     type=\"string\",\n *     description=\"Text message\"\n *  ),\n *  @OA\\Property(\n *     property=\"time\",\n *     type=\"integer\",\n *     description=\"Server current Unix time\"\n *  ),\n *  @OA\\Property(\n *     property=\"date\",\n *     type=\"string\",\n *     format=\"date-time\",\n *     description=\"Server current date time\"\n *  )\n *)\n */\nclass HelloModel\n{\n...\n```\n\n## Screenshot\n\n![Swagger UI Screenshot](/docs/swagger-ui-screenshot.png)\n\n## Donate\n\u003ca href=\"https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=2PURUX2SHUD9E\"\u003e\u003cimg src=\"https://www.paypalobjects.com/en_US/RU/i/btn/btn_donateCC_LG.gif\"\u003e\u003c/a\u003e\n\n## LICENSE\nThis curl wrapper is released under the [MIT license](/LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgenxoft%2Fphp-swagger-module","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgenxoft%2Fphp-swagger-module","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgenxoft%2Fphp-swagger-module/lists"}