PHPackages                             maxbeckers/php-openapi-generator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. maxbeckers/php-openapi-generator

ActiveComposer-plugin[Parsing &amp; Serialization](/categories/parsing)

maxbeckers/php-openapi-generator
================================

Parse OpenAPI specs with PHP

0.1.6(1mo ago)166MITPHPPHP &gt;=8.2CI passing

Since Jun 5Pushed 1mo agoCompare

[ Source](https://github.com/maxbeckers/php-openapi-generator)[ Packagist](https://packagist.org/packages/maxbeckers/php-openapi-generator)[ RSS](/packages/maxbeckers-php-openapi-generator/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (7)Dependencies (16)Versions (8)Used By (0)

PHP OpenAPI Generator
=====================

[](#php-openapi-generator)

[![PHP Version](https://camo.githubusercontent.com/c9f64f714c636ba27a3bba6dfd52f98426832db1262747efa54b212d16943651/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e322d626c7565)](https://php.net)[![License](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)](LICENSE)[![Tests](https://github.com/maxbeckers/php-openapi-generator/workflows/Tests/badge.svg)](https://github.com/maxbeckers/php-openapi-generator/actions)

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
----------------

[](#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
--------

[](#features)

- Typed model generation from `components/schemas` (classes, enums, nested objects)
- Server contract generation from `paths` with 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()` and `toArray()`)
- Operation filtering by tags, operation IDs, and path patterns
- Extension plugin system for `x-*` vendor extensions (for example `x-trim`)

Requirements
------------

[](#requirements)

- PHP `>=8.2`
- Composer `>=2.0`

Installation
------------

[](#installation)

```
composer require --dev maxbeckers/php-openapi-generator
```

Because this package is a Composer plugin, allow it in `composer.json`:

```
{
  "config": {
	"allow-plugins": {
	  "maxbeckers/php-openapi-generator": true
	}
  }
}
```

The CLI binary is available at `vendor/bin/openapi-gen`.

Quick Start
-----------

[](#quick-start)

### 1) Create `php-openapi-generator.php`

[](#1-create-php-openapi-generatorphp)

```
