Getting started

Installation

Require the package, publish its configuration and add the optional dependencies.

Require the package

Terminal
composer require ark4ne/laravel-openapi-generator

It installs OpenAPI Writer, which writes the documents. The service provider is discovered by Laravel.

Publish the configuration

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

config/openapi.php is documented key by key; see the configuration reference. It declares one document, v1, in OpenAPI 3.1.2, made of the routes under api/.

Generate the document

Terminal
php artisan openapi:generate

The document is written on the default disk, in openapi/openapi-v1.json.

Check the installation

Terminal
php artisan about

The OpenAPI Generator section shows the version of the package, the documents of the configuration and whether the JSON:API integration is enabled.

Optional dependencies

PackageAdds
opis/json-schemaValidation of every generated document against the official OpenAPI schemas. Recommended.
symfony/yamlDocuments written as YAML (output.format, --format=yaml).
ark4ne/laravel-json-apiJSON:API resources and requests documented as such: ^1.9, ^2.0 or ^3.0. See JSON:API.
Terminal
composer require --dev opis/json-schema
composer require symfony/yaml

Coding agents

Agents such as Claude Code or Cursor can load the skills shipped in vendor/ark4ne/laravel-openapi-generator/skills/: laravel-openapi-generator (the rules, every attribute, configuration key and extension point, tested recipes) and laravel-openapi-generator-upgrade (the migration from 0.6). See Agent skills.