{"id":15286043,"url":"https://github.com/sirn-se/phrity-slim-openapi","last_synced_at":"2025-04-13T03:07:45.678Z","repository":{"id":59834874,"uuid":"277782627","full_name":"sirn-se/phrity-slim-openapi","owner":"sirn-se","description":"[php-lib] OpenApi implementation for Slim 4","archived":false,"fork":false,"pushed_at":"2023-06-21T20:30:16.000Z","size":65,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-13T03:07:39.875Z","etag":null,"topics":["openapi","php","php-library","slim","slim-framework"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sirn-se.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-07-07T10:08:45.000Z","updated_at":"2025-03-14T23:07:01.000Z","dependencies_parsed_at":"2022-09-22T19:41:59.365Z","dependency_job_id":"30453761-5602-4ed5-b37d-86c8bba6e0b1","html_url":"https://github.com/sirn-se/phrity-slim-openapi","commit_stats":{"total_commits":28,"total_committers":2,"mean_commits":14.0,"dds":0.1428571428571429,"last_synced_commit":"9f57f9ca0f76dd15ac4699186200a87fd1d03c0b"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sirn-se%2Fphrity-slim-openapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sirn-se%2Fphrity-slim-openapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sirn-se%2Fphrity-slim-openapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sirn-se%2Fphrity-slim-openapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sirn-se","download_url":"https://codeload.github.com/sirn-se/phrity-slim-openapi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248657918,"owners_count":21140846,"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","php","php-library","slim","slim-framework"],"created_at":"2024-09-30T15:10:16.443Z","updated_at":"2025-04-13T03:07:45.659Z","avatar_url":"https://github.com/sirn-se.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://github.com/sirn-se/phrity-slim-openapi/actions/workflows/acceptance.yml/badge.svg)](https://github.com/sirn-se/phrity-slim-openapi/actions)\n[![Coverage Status](https://coveralls.io/repos/github/sirn-se/phrity-slim-openapi/badge.svg?branch=master)](https://coveralls.io/github/sirn-se/phrity-slim-openapi?branch=master)\n\n# OpenApi for Slim v4\n\nAdapter that reads [OpenApi](https://spec.openapis.org) schema and add included routes to [Slim](https://www.slimframework.com).\nBy defining `operationId` in OpenApi schema, the adapter will automatically instanciate and call referenced controller class.\n\nSome features\n- Automatic mapping of routes to controllers\n- OpenApi specification in JSON or YAML source\n- Optional validation of requests and responses\n\n\n## Installation\n\nInstall with [Composer](https://getcomposer.org/);\n```\ncomposer require phrity/slim-openapi\n```\n\n## How to use\n\n```php\nuse Phrity\\Slim\\OpenApi;\nuse Slim\\Factory\\AppFactory;\n\n// Create Slim App as you normally would\n$slim = AppFactory::create();\n\n// Create OpenApi adapter with OpenApi source\n$openapi = new OpenApi('openapi.json');\n\n// Push all routes from OpenApi to Slim\n$openapi-\u003eroute($slim);\n\n// Run Slim\n$slim-\u003erun();\n```\n\n## How to define controllers\n\nIn order for automatic mapping to work, the `operationId` must be set on all defined routes in OpenApi source.\nIf no method is specified, class method `__invoke()` will be called on class.\n\n| With invoke | With method |\n| --- | --- |\n| `Classname` | `Classname:method` |\n| `Namespace/Classname` | `Namespace/Classname:method` |\n| `Namespace\\\\Classname` | `Namespace\\\\Classname:method` |\n\n### Example\n\n```json\n{\n    \"openapi\": \"3.0.0\",\n    \"paths\": {\n        \"/test\": {\n            \"get\": {\n                \"operationId\": \"Test/MyController\",\n                \"description\": \"Will invoke on class Test\\\\MyController\"\n            },\n            \"put\": {\n                \"operationId\": \"Test\\\\MyController:put\",\n                \"description\": \"Will call method put() on class Test\\\\MyController\"\n            }\n        }\n    }\n}\n```\n\n\n# Documentation\n\n- [Basics](docs/Basics.md)\n- [Settings](docs/Settings.md)\n- [Validation](docs/Validation.md)\n- [Extras](docs/Extras.md)\n\n\n## Versions\n\n| Version | PHP | |\n| --- | --- | --- |\n| `1.2` | `^7.4\\|^8.0` | Request/Response validation, YAML support |\n| `1.1` | `^7.4\\|^8.0` | Settings \u0026 helpers |\n| `1.0` | `^7.4\\|^8.0` | Route registry |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsirn-se%2Fphrity-slim-openapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsirn-se%2Fphrity-slim-openapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsirn-se%2Fphrity-slim-openapi/lists"}