PHPackages                             ez-php/openapi - 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. [Framework](/categories/framework)
4. /
5. ez-php/openapi

ActiveLibrary[Framework](/categories/framework)

ez-php/openapi
==============

OpenAPI 3.x spec generator for the ez-php framework — PHP attributes on controllers, reflection-based spec building, GET /openapi.json endpoint

1.3.0(1mo ago)00MITPHPPHP ^8.5CI passing

Since Mar 30Pushed 1mo agoCompare

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

READMEChangelogDependencies (9)Versions (2)Used By (0)

ez-php/openapi
==============

[](#ez-phpopenapi)

OpenAPI 3.0.0 spec generator for the ez-php framework. Annotate controller methods with PHP attributes and get a live `GET /openapi.json` endpoint — no code generation, no annotation parsing framework, no YAML.

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

[](#installation)

```
composer require ez-php/openapi
```

Register the service provider in `provider/modules.php`:

```
$app->register(\EzPhp\OpenApi\OpenApiServiceProvider::class);
```

Usage
-----

[](#usage)

Add attributes to your controller methods:

```
use EzPhp\OpenApi\Attributes\ApiOperation;
use EzPhp\OpenApi\Attributes\ApiParam;
use EzPhp\OpenApi\Attributes\ApiResponse;

final class UserController
{
    #[ApiOperation(summary: 'List users', tags: ['users'])]
    #[ApiResponse(200, 'List of users')]
    #[ApiParam('search', 'string', 'query', false, 'Filter by name')]
    public function index(Request $request): Response { ... }

    #[ApiOperation(summary: 'Get user')]
    #[ApiResponse(200, 'The user', UserSchema::class)]
    #[ApiResponse(404, 'Not found')]
    #[ApiParam('id', 'integer', 'path', true, 'The user ID')]
    public function show(Request $request): Response { ... }
}
```

Visit `GET /openapi.json` to retrieve the generated spec.

Attributes
----------

[](#attributes)

### `#[ApiOperation]`

[](#apioperation)

ParameterTypeDefaultDescription`$summary``string``''`Short description of the operation`$description``string``''`Longer Markdown description`$tags``list``[]`Tag names for grouping in the UINot repeatable — one per method.

### `#[ApiResponse]`

[](#apiresponse)

ParameterTypeDefaultDescription`$status``int`—HTTP status code (required)`$description``string``''`Human-readable description`$schemaClass``?string``null`FQCN used to emit a `$ref` in the responseRepeatable — multiple responses per method.

### `#[ApiParam]`

[](#apiparam)

ParameterTypeDefaultDescription`$name``string`—Parameter name (required)`$type``string``'string'`JSON Schema type: `string`, `integer`, `boolean``$in``string``'query'`Location: `path`, `query`, `header`, `cookie``$required``bool``false`Whether required (path params always required)`$description``string``''`Human-readable descriptionRepeatable — multiple parameters per method.

Configuration
-------------

[](#configuration)

KeyDefaultDescription`app.name``'API'`Spec `info.title``app.version``'1.0.0'`Spec `info.version``openapi.endpoint``'/openapi.json'`URI for the generated specNotes
-----

[](#notes)

- Only `[Controller::class, 'method']` handler routes are reflected for attributes. Closure-based routes appear in the spec without attribute data.
- Path parameters (`{id}`) are auto-detected from route patterns and added as `in: 'path', required: true, type: 'string'` when not explicitly declared via `#[ApiParam]`.
- Component schemas (`#/components/schemas/...`) referenced by `$schemaClass` must be registered separately — this module generates the `$ref` but not the schema definition.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance90

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

46d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a15a63c46d239d42b8ed4c2fe9adbc5fe99eb62f6e5bb90f08021e0c068e8b37?d=identicon)[AU9500](/maintainers/AU9500)

---

Top Contributors

[![AU9500](https://avatars.githubusercontent.com/u/122030400?v=4)](https://github.com/AU9500 "AU9500 (8 commits)")

---

Tags

phpapiframeworkdocumentationswaggeropenapispecez-php

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/ez-php-openapi/health.svg)

```
[![Health](https://phpackages.com/badges/ez-php-openapi/health.svg)](https://phpackages.com/packages/ez-php-openapi)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
