{"id":36983214,"url":"https://github.com/uderline/openapi-php-attributes","last_synced_at":"2026-01-13T22:55:54.217Z","repository":{"id":41478641,"uuid":"374416484","full_name":"uderline/openapi-php-attributes","owner":"uderline","description":"Automatically render your OpenApi 3 file describing your PHP API using attributes","archived":false,"fork":false,"pushed_at":"2024-03-25T20:19:00.000Z","size":169,"stargazers_count":21,"open_issues_count":2,"forks_count":8,"subscribers_count":3,"default_branch":"master","last_synced_at":"2026-01-02T09:23:13.733Z","etag":null,"topics":["api","api-rest","attributes","json","json-schema","openapi","openapi3","php","php8","renderer","swagger"],"latest_commit_sha":null,"homepage":"https://uderline.github.io/openapi-php-attributes/","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/uderline.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-06-06T16:59:48.000Z","updated_at":"2024-05-03T14:58:45.000Z","dependencies_parsed_at":"2023-01-31T19:01:38.710Z","dependency_job_id":"92d84bc7-f107-4dd0-8344-e3f45c0e6214","html_url":"https://github.com/uderline/openapi-php-attributes","commit_stats":{"total_commits":77,"total_committers":10,"mean_commits":7.7,"dds":0.3246753246753247,"last_synced_commit":"2027e8ea132aaa6e221f95636f53cabf312696d2"},"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"purl":"pkg:github/uderline/openapi-php-attributes","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uderline%2Fopenapi-php-attributes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uderline%2Fopenapi-php-attributes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uderline%2Fopenapi-php-attributes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uderline%2Fopenapi-php-attributes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uderline","download_url":"https://codeload.github.com/uderline/openapi-php-attributes/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uderline%2Fopenapi-php-attributes/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28402192,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T14:36:09.778Z","status":"ssl_error","status_checked_at":"2026-01-13T14:35:19.697Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["api","api-rest","attributes","json","json-schema","openapi","openapi3","php","php8","renderer","swagger"],"created_at":"2026-01-13T22:55:53.671Z","updated_at":"2026-01-13T22:55:54.206Z","avatar_url":"https://github.com/uderline.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenAPI PHP Attributes Generator\n\nThis CLI Tool is able to generate an OpenApi JSON file description according to PHP attributes contained in your files.\n\n## ⚠️ Missing something ?\nJust open an issue saying what's missing ! Feel free to open a PR but we recommend opening an issue beforehand.\n\n## Where to start ?\n1 - Install the package openapi-php-attributes-generator with composer.\n\n```bash\ncomposer require uderline/openapi-php-attributes\n```\n\n2 - Describe your API by following this documentation: https://uderline.github.io/openapi-php-attributes/\n\n3 - Generate the JSON file:\n```bash\nphp ./vendor/bin/opag /src/files/project openapi.json\n```\n\nA new file called `openapi.json` has been generated !\n\n## Example\n```php\n#[Controller]\nclass Controller {\n    #[\n        GET(\"/path/{id}\", [\"Tag1\", \"Tag2\"], \"Description of the method\"),\n        Property(Type::STRING, \"prop1\", description: \"Property description\", enum: BackedEnum::class),\n        Property(Type::INT, \"prop2\", example: 1),\n        Property(Type::BOOLEAN, \"prop3\"),\n        Property(Type::REF, \"prop4\", ref: RefSchema::class)\n        Response(ref: SchemaName::class, description: \"Response description\")\n    ]\n    public function get(#[Parameter(\"Parameter description\")] int $id): JsonResponse {\n        // ...\n    }\n}\n\nenum BackedEnum: string\n{\n    case VAL1: \"val1\";\n    case VAL2: \"val2\";\n}\n\n#[\n    Schema,\n    Property(Type::STRING, \"Property 1\"),\n    Property(Type::INT, \"Property 2\"),\n]\nclass RefSchema\n{\n    public string $property1;\n    public int $property2;\n}\n```\n\nWill generate\n```json\n{\n    \"paths\": {\n        \"/path/{id}\": {\n            \"post\": {\n                \"tags\": [\n                    \"Tag1\",\n                    \"Tag2\"\n                ],\n                \"summary\": \"Description of the method\",\n                \"parameters\": [\n                    {\n                        \"name\": \"id\",\n                        \"in\": \"path\",\n                        \"description\": \"Parameter description\",\n                        \"required\": true,\n                        \"schema\": {\n                            \"type\": \"integer\"\n                        }\n                    }\n                ],\n                \"requestBody\": {\n                    \"content\": {\n                        \"application/json\": {\n                            \"schema\": {\n                                \"type\": \"object\",\n                                \"properties\": {\n                                    \"prop1\": {\n                                        \"type\": \"string\",\n                                        \"description\": \"Property description\",\n                                        \"enum\": [\n                                            \"val1\",\n                                            \"val2\"\n                                        ]\n                                    },\n                                    \"prop2\": {\n                                        \"type\": \"integer\",\n                                        \"description\": \"\"\n                                    },\n                                    \"prop3\": {\n                                        \"type\": \"boolean\",\n                                        \"description\": \"\"\n                                    },\n                                    \"prop4\": {\n                                        \"$ref\": \"#/components/schemas/RefSchema\"\n                                    }\n                                }\n                            }\n                        }\n                    }\n                },\n                \"responses\": {\n                    \"200\": {\n                        \"description\": \"Response description\",\n                        \"content\": {\n                            \"application/json\": {\n                                \"schema\": {\n                                    \"$ref\": \"#/components/schemas/DummyComponent\"\n                                }\n                            }\n                        }\n                    }\n                }\n            }\n        }\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuderline%2Fopenapi-php-attributes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuderline%2Fopenapi-php-attributes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuderline%2Fopenapi-php-attributes/lists"}