PHPackages                             specdocular/laravel-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. [HTTP &amp; Networking](/categories/http)
4. /
5. specdocular/laravel-openapi

ActiveLibrary[HTTP &amp; Networking](/categories/http)

specdocular/laravel-openapi
===========================

Generate OpenAPI Specification for Laravel Applications

v0.2.0(2mo ago)0374↓50%MITPHPPHP ^8.2CI passing

Since Feb 13Pushed 2mo agoCompare

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

READMEChangelogDependencies (24)Versions (3)Used By (0)

Laravel OpenAPI
===============

[](#laravel-openapi)

[![Latest Version on Packagist](https://camo.githubusercontent.com/fe7c8d5633a28ea1b36badda6aa8aeebddf9e34adf7a548fa9dcee3325e92586/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73706563646f63756c61722f6c61726176656c2d6f70656e6170692e737667)](https://packagist.org/packages/specdocular/laravel-openapi)[![PHP Version](https://camo.githubusercontent.com/6b0d9586168f674fbd1f481946ac6f01910443360c80f5226bbf030f9b428346/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f73706563646f63756c61722f6c61726176656c2d6f70656e6170692e737667)](https://packagist.org/packages/specdocular/laravel-openapi)[![Tests](https://github.com/specdocular/laravel-openapi/actions/workflows/tests.yml/badge.svg)](https://github.com/specdocular/laravel-openapi/actions/workflows/tests.yml)[![codecov](https://camo.githubusercontent.com/586e754cabe1aabf5eedda8b834248b084c422d75f206c05ec96020bf23819c8/68747470733a2f2f636f6465636f762e696f2f67682f73706563646f63756c61722f6c61726176656c2d6f70656e6170692f67726170682f62616467652e737667)](https://codecov.io/gh/specdocular/laravel-openapi)[![Code Style](https://github.com/specdocular/laravel-openapi/actions/workflows/php-cs-fixer.yml/badge.svg)](https://github.com/specdocular/laravel-openapi/actions/workflows/php-cs-fixer.yml)

Generate [OpenAPI 3.1.x](https://spec.openapis.org/oas/v3.1.1.html) specifications for Laravel applications using a factory-based, "Laravel way" approach.

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

[](#installation)

```
composer require specdocular/laravel-openapi
```

The service provider is auto-discovered by Laravel. Publish the config:

```
php artisan vendor:publish --tag=openapi-config
```

Usage
-----

[](#usage)

### 1. Create an OpenAPI Factory

[](#1-create-an-openapi-factory)

```
use Specdocular\LaravelOpenAPI\Factories\OpenAPIFactory;
use Specdocular\OpenAPI\Schema\Objects\OpenAPI\OpenAPI;
use Specdocular\OpenAPI\Schema\Objects\Info\Info;

class MyAPIFactory extends OpenAPIFactory
{
    public function instance(): OpenAPI
    {
        return OpenAPI::v311(
            Info::create('My API', '1.0.0')
                ->description('API documentation'),
        );
    }
}
```

### 2. Configure Scopes

[](#2-configure-scopes)

In `config/openapi.php`:

```
'scopes' => [
    'default' => [
        'openapi' => MyAPIFactory::class,
        'directories' => [
            app_path('OpenAPI'),
        ],
    ],
],
```

### 3. Create Component Factories

[](#3-create-component-factories)

Define reusable request bodies, responses, schemas, and parameters as factory classes. Place them in your configured directories and they will be auto-discovered.

### 4. Generate the Spec

[](#4-generate-the-spec)

```
$openApi = app(\Specdocular\LaravelOpenAPI\Generator::class)
    ->generate('default');

$json = json_encode($openApi, JSON_PRETTY_PRINT);
```

Features
--------

[](#features)

- Factory-based component system (schemas, responses, request bodies, parameters)
- Auto-discovery of factories from configured directories
- Multi-scope support for separate API versions or modules
- Route-based generation using Laravel route attributes
- Built on [specdocular/php-openapi](https://github.com/specdocular/php-openapi) for the OpenAPI object model

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

[](#related-packages)

PackageDescription[specdocular/php-json-schema](https://github.com/specdocular/php-json-schema)JSON Schema Draft 2020-12 builder[specdocular/php-openapi](https://github.com/specdocular/php-openapi)Object-oriented OpenAPI builder (foundation)[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

38

—

LowBetter than 85% of packages

Maintenance84

Actively maintained with recent releases

Popularity15

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity37

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

Every ~12 days

Total

2

Last Release

82d 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 (13 commits)")

---

Tags

apilaravelrestdocumentationswaggeropenapidocs

###  Code Quality

TestsPest

Static AnalysisPHPStan, Psalm, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[vyuldashev/laravel-openapi

Generate OpenAPI Specification for Laravel Applications

4571.2M](/packages/vyuldashev-laravel-openapi)[api-platform/core

Build a fully-featured hypermedia or GraphQL API in minutes!

2.6k48.1M236](/packages/api-platform-core)[tartanlegrand/laravel-openapi

Generate OpenAPI Specification for Laravel Applications

38178.7k2](/packages/tartanlegrand-laravel-openapi)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)[noitran/opendox

OpenApi(Swagger) 3.0 package for Lumen 5.5+ and Laravel 5.5+ with REDOC UI and SwaggerUI 3

2313.9k](/packages/noitran-opendox)[vanderlee/swaggergen

Generate Swagger/OpenAPI documentation from simple PHPdoc-like comments in PHP source code.

42127.9k3](/packages/vanderlee-swaggergen)

PHPackages © 2026

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