PHPackages                             specdocular/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. [API Development](/categories/api)
4. /
5. specdocular/php-openapi

ActiveLibrary[API Development](/categories/api)

specdocular/php-openapi
=======================

Object-oriented OpenAPI implementation for PHP

v0.1.0(3mo ago)0443↓50%1MITPHPPHP ^8.2CI passing

Since Feb 13Pushed 2mo agoCompare

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

READMEChangelogDependencies (15)Versions (2)Used By (1)

PHP OpenAPI
===========

[](#php-openapi)

[![Latest Version on Packagist](https://camo.githubusercontent.com/8af9a8ae4ab194c86dd91b27cda30230791b67b8f8f50bca125294bd03c828e1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73706563646f63756c61722f7068702d6f70656e6170692e737667)](https://packagist.org/packages/specdocular/php-openapi)[![PHP Version](https://camo.githubusercontent.com/b4877e645282ab9417e02906f0fc3b4b464a4bec60f0a8818f8179eacfa0864c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f73706563646f63756c61722f7068702d6f70656e6170692e737667)](https://packagist.org/packages/specdocular/php-openapi)[![Tests](https://github.com/specdocular/php-openapi/actions/workflows/tests.yml/badge.svg)](https://github.com/specdocular/php-openapi/actions/workflows/tests.yml)[![codecov](https://camo.githubusercontent.com/819c700a6d7c7d18952eca08654a0b72233c063e11336b3ce20a038299c66fd7/68747470733a2f2f636f6465636f762e696f2f67682f73706563646f63756c61722f7068702d6f70656e6170692f67726170682f62616467652e737667)](https://codecov.io/gh/specdocular/php-openapi)[![Code Style](https://github.com/specdocular/php-openapi/actions/workflows/php-cs-fixer.yml/badge.svg)](https://github.com/specdocular/php-openapi/actions/workflows/php-cs-fixer.yml)

An object-oriented [OpenAPI 3.1.x](https://spec.openapis.org/oas/v3.1.1.html) builder for PHP. Build complete API specifications with a fluent, chainable API that hides the complexity of the OpenAPI specification.

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

[](#installation)

```
composer require specdocular/php-openapi
```

Usage
-----

[](#usage)

```
use Specdocular\OpenAPI\Schema\Objects\OpenAPI\OpenAPI;
use Specdocular\OpenAPI\Schema\Objects\Info\Info;
use Specdocular\OpenAPI\Schema\Objects\PathItem\PathItem;
use Specdocular\OpenAPI\Schema\Objects\Operation\Operation;
use Specdocular\OpenAPI\Schema\Objects\Schema\Schema;
use Specdocular\JsonSchema\Draft202012\Keywords\Properties\Property;

$openApi = OpenAPI::v311(
    Info::create('Pet Store', '1.0.0')
        ->description('A sample Pet Store API')
);

// Define schemas
$petSchema = Schema::object()
    ->properties(
        Property::create('id', Schema::string()->format('uuid')),
        Property::create('name', Schema::string()),
    )
    ->required('id', 'name');

// Export as JSON
$json = json_encode($openApi, JSON_PRETTY_PRINT);
```

Features
--------

[](#features)

- Fluent, chainable API for all OpenAPI 3.1.x objects
- Full support for Paths, Operations, Schemas, Responses, Request Bodies, Parameters, Security Schemes, and more
- Automatic component reference collection and management
- Built on [specdocular/php-json-schema](https://github.com/specdocular/php-json-schema) for schema definitions
- Framework-agnostic — no dependencies on Laravel or any framework

Related Packages
----------------

[](#related-packages)

PackageDescription[specdocular/php-json-schema](https://github.com/specdocular/php-json-schema)JSON Schema Draft 2020-12 builder (foundation)[specdocular/laravel-openapi](https://github.com/specdocular/laravel-openapi)Laravel integration for OpenAPI generation (uses this package)[specdocular/laravel-rules-to-schema](https://github.com/specdocular/laravel-rules-to-schema)Convert Laravel validation rules to JSON SchemaLicense
-------

[](#license)

MIT. See [LICENSE](LICENSE) for details.

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance83

Actively maintained with recent releases

Popularity15

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 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

94d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e05ce3549156452319c5fdfc014b5eb441e3a6148f1f4957fb863026ecc6f8a0?d=identicon)[mohammad-alavi](/maintainers/mohammad-alavi)

---

Top Contributors

[![Mohammad-Alavi](https://avatars.githubusercontent.com/u/24431504?v=4)](https://github.com/Mohammad-Alavi "Mohammad-Alavi (11 commits)")

---

Tags

phpapispecificationswaggeropenapi

###  Code Quality

TestsPest

Static AnalysisPHPStan, Psalm, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[swagger-api/swagger-ui

 Swagger UI is a collection of HTML, Javascript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.

28.8k45.4M99](/packages/swagger-api-swagger-ui)[darkaonline/l5-swagger

OpenApi or Swagger integration to Laravel

2.9k34.0M112](/packages/darkaonline-l5-swagger)[darkaonline/swagger-lume

OpenApi or Swagger integration to Lumen

3372.3M3](/packages/darkaonline-swagger-lume)[harmbandstra/swagger-ui-bundle

Exposes swagger UI inside your Symfony project through a route (eg. /docs)

42867.3k](/packages/harmbandstra-swagger-ui-bundle)[psx/api

Parse and generate API specification formats

37178.0k4](/packages/psx-api)

PHPackages © 2026

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