{"id":15068618,"url":"https://github.com/prometee/openapiclientgenerator","last_synced_at":"2026-02-23T20:04:36.791Z","repository":{"id":62530903,"uuid":"174589100","full_name":"Prometee/OpenApiClientGenerator","owner":"Prometee","description":"OpenApi PHP8 skeleton client builder","archived":false,"fork":false,"pushed_at":"2024-05-23T13:35:30.000Z","size":237,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-24T16:53:35.466Z","etag":null,"topics":["api","generator","openapi","php8"],"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/Prometee.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-08T18:32:33.000Z","updated_at":"2024-05-23T13:34:51.000Z","dependencies_parsed_at":"2024-10-13T04:41:08.588Z","dependency_job_id":"3462bd13-a583-4c72-8b02-a09912d0199e","html_url":"https://github.com/Prometee/OpenApiClientGenerator","commit_stats":null,"previous_names":["prometee/openapiclientgenerator"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Prometee%2FOpenApiClientGenerator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Prometee%2FOpenApiClientGenerator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Prometee%2FOpenApiClientGenerator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Prometee%2FOpenApiClientGenerator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Prometee","download_url":"https://codeload.github.com/Prometee/OpenApiClientGenerator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244181356,"owners_count":20411601,"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":["api","generator","openapi","php8"],"created_at":"2024-09-25T01:38:35.858Z","updated_at":"2025-10-29T05:41:13.673Z","avatar_url":"https://github.com/Prometee.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Latest Version on Packagist][ico-version]][link-packagist]\n[![Software License][ico-license]](LICENSE)\n[![Build Status][ico-github-actions]][link-github-actions]\n[![Quality Score][ico-code-quality]][link-code-quality]\n\n## OpenApi PHP8 client generator\n\nThis library is designed to generate PHP8 model and operation classes from an Open API json file.\n\n## Installation\n\nInstall using Composer :\n\n```\n$ composer require prometee/openapi-client-generator\n```\n\n## Usage\n\n```php\n\ndeclare(strict_types=1);\n\n$loader = require_once( __DIR__.'/vendor/autoload.php');\n\nuse Prometee\\PhpClassGenerator\\Builder\\ClassBuilder;\nuse Prometee\\PhpClassGenerator\\Builder\\Model\\ModelFactoryBuilder;\nuse Prometee\\PhpClassGenerator\\Builder\\View\\ViewFactoryBuilder;\nuse Prometee\\SwaggerClientGenerator\\OpenApi\\Helper\\ModelHelper;\nuse Prometee\\SwaggerClientGenerator\\OpenApi\\Helper\\OperationsHelper;\nuse Prometee\\SwaggerClientGenerator\\PhpGenerator\\Converter\\ModelConverter;\nuse Prometee\\SwaggerClientGenerator\\PhpGenerator\\Converter\\OpenApiConverter;\nuse Prometee\\SwaggerClientGenerator\\PhpGenerator\\Converter\\OperationsConverter;\nuse Prometee\\SwaggerClientGenerator\\PhpGenerator\\PhpGenerator;\nuse Prometee\\SwaggerClientGenerator\\PhpGenerator\\Operation\\OperationsMethodGenerator;\n\n$baseUri = 'https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.0/petstore-expanded.json';\n$folder = __DIR__ . '/build';\n$namespace = 'Tests\\\\Prometee\\\\SwaggerClientGenerator\\\\Build';\n$abstractOperationClass = \\MyVendor\\MyApi\\AbstractOperations::class;\n$throwClasses = [\n    \\MyVendorMyApi\\piException =\u003e 'ApiException',\n    \\Http\\Client\\Exception =\u003e 'HttpClientException',\n    \\Symfony\\Component\\Serializer\\Exception\\ExceptionInterface =\u003e 'SerializerExceptionInterface',\n];\n\n// Instantiate the PHP class generator.\n// It builds PHP classes from a given array config.\n$phpGenerator = new PhpGenerator(\n    new ClassBuilder(\n        new ModelFactoryBuilder(),\n        new ViewFactoryBuilder()\n    )\n);\n\n// Instantiate the Open API model converter.\n// It will convert model definitions to an array of config for the PhpGenerator.\n$modelConverter = new ModelConverter(\n    'Model',\n    $namespace,\n    new ModelHelper()\n);\n\n// Instantiate the Open API operations converter.\n// It will create array of config for the PhpGenerator to create Operations classes.\n// They will contain for example each \"GET /pets\" \"GET /pets/{id}\" methods to query the API. \n$operationsConverter = new OperationsConverter(\n    'Operations',\n    $namespace . \"\\\\\" . $modelConverter-\u003egetModelNamespacePrefix(),\n    new OperationsHelper(),\n    new OperationsMethodGenerator()\n);\n\n// 0.1. Configure the PHP Generator\n$phpGenerator-\u003econfigure($path, $namespace);\n// 0.2. Configure the Operations classes with some default extending class\n$operationsConverter-\u003esetAbstractOperationsClass($abstractOperationClass);\n// 0.3. Configure the Operations classes with some PHPDoc @throw class on each generated methods\n$operationsConverter-\u003esetThrowsClasses($throwClasses);\n\n// 1. Convert OpenApi schema to an array understandable by the PhpGenerator\n$openApiConverter = new OpenApiConverter($baseUri, $modelConverter, $operationsConverter);\n$classConfig = $openApiConverter-\u003econvert();\n\n// 2. Create PHP classes thank to the config given\n$phpGenerator-\u003esetClassesConfig($classConfig);\n$phpGenerator-\u003egenerate();\n\n```\n\n[ico-version]: https://img.shields.io/packagist/v/Prometee/openapi-client-generator.svg?style=flat-square\n[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square\n[ico-github-actions]: https://github.com/Prometee/OpenApiClientGenerator/workflows/Build/badge.svg\n[ico-code-quality]: https://img.shields.io/scrutinizer/g/Prometee/OpenApiClientGenerator.svg?style=flat-square\n\n[link-packagist]: https://packagist.org/packages/Prometee/openapi-client-generator\n[link-github-actions]: https://github.com/Prometee/OpenApiClientGenerator/actions?query=workflow%3A\"Build\"\n[link-code-quality]: https://scrutinizer-ci.com/g/Prometee/OpenApiClientGenerator\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprometee%2Fopenapiclientgenerator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprometee%2Fopenapiclientgenerator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprometee%2Fopenapiclientgenerator/lists"}