Download the PHP package maxbeckers/php-openapi-generator without Composer
On this page you can find all versions of the php package maxbeckers/php-openapi-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download maxbeckers/php-openapi-generator
More information about maxbeckers/php-openapi-generator
Files in maxbeckers/php-openapi-generator
Package php-openapi-generator
Short Description Parse OpenAPI specs with PHP
License MIT
Informations about the package php-openapi-generator
PHP OpenAPI Generator
Generate strongly typed PHP 8.2+ models, server contracts, and API clients directly from OpenAPI 3.x specs.
This package is designed for teams that want generated code to feel like hand-written application code: explicit types, predictable method signatures, and minimal runtime magic.
Why This Project
- PHP-native workflow: no npm toolchain required for day-to-day generation
- Lightweight by design: generate plain PHP classes/interfaces you can read and own
- Framework-friendly: Symfony and Laravel server glue, plus multiple client adapters
- Great for contract-first teams: keep OpenAPI as source of truth and regenerate safely
Features
- Typed model generation from
components/schemas(classes, enums, nested objects) - Server contract generation from
pathswith selectable framework target (None,Symfony,Laravel) - Client generation with pluggable HTTP adapters (
Symfony HttpClient,Guzzle,PSR-18) - Optional framework and adapter version flags for version-specific code generation when upstream APIs change
- DTO hydration/serialization helpers (
fromArray()andtoArray()) - Operation filtering by tags, operation IDs, and path patterns
- Extension plugin system for
x-*vendor extensions (for examplex-trim)
Requirements
- PHP
>=8.2 - Composer
>=2.0
Installation
Because this package is a Composer plugin, allow it in composer.json:
The CLI binary is available at vendor/bin/openapi-gen.
Quick Start
1) Create php-openapi-generator.php
2) Generate code
3) Choose a practical quickstart path
Server quickstart (Symfony or Laravel)
Then:
- Generate code with
vendor/bin/openapi-gen - Implement generated
*ApiInterfacemethods - Keep generated controllers/routes as thin transport glue
Client quickstart (typed API consumers)
Then:
- Generate code with
vendor/bin/openapi-gen - Inject
*ApiClientinto your services - Use generated DTOs for request/response mapping
4) Optional overrides from CLI
What Gets Generated
Models are always generated.
Server target (GenerationTarget::Server)
FrameworkTarget::None:*ApiInterfaceonly (pure contract)FrameworkTarget::Symfony:*ApiInterface+ generated*ApiControlleractions with#[Route]FrameworkTarget::Laravel:*ApiInterface+ generated*ApiController+*ApiRouteshelper
Optional: set $config->frameworkVersion when server framework major versions require different generated glue.
Client target (GenerationTarget::Client)
*ApiClientInterface*ApiClient
Adapters:
HttpClientAdapter::SymfonyHttpClientHttpClientAdapter::GuzzleHttpClientAdapter::Psr18
Optional: set $config->httpClientVersion when adapter major versions require different generated transport code.
Recommended Workflow
- Keep your OpenAPI spec in source control.
- Regenerate code when the spec changes.
- Implement generated server interfaces or inject generated clients.
- Decide as a team whether to commit generated code or regenerate in CI.
Examples
examples/petstore-client-symfonyexamples/petstore-server-symfony
Documentation
- Docs Index
- Getting Started
- Server Quickstart
- Client Quickstart
- Configuration Reference
- Framework Targets (Server)
- Client Generation
- HTTP Client Adapters
- Validation Strategies
- Extension Plugins (
x-*)
Development
License
MIT - see LICENSE.
Issues and feedback: github.com/maxbeckers/php-openapi-generator/issues
Built with ❤️ for PHP developers
All versions of php-openapi-generator with dependencies
composer-plugin-api Version ^2.0
maxbeckers/php-yaml-parser Version ^0.6.0
twig/twig Version ^3.0
symfony/console Version ^7.0|^8.0