Install
Requirements
Section titled “Requirements”- PHP 8.1+
- Laravel 10 / 11
- spatie/laravel-data ^3.9 or ^4.0
Installation
Section titled “Installation”-
Require the package:
Terminal window composer require langsys/openapi-docs-generator -
Publish the config:
Terminal window php artisan vendor:publish --provider="Langsys\OpenApiDocsGenerator\OpenApiDocsServiceProvider" --tag=configThis creates
config/openapi-docs.php.
Quick start
Section titled “Quick start”Out of the box, the package scans your entire app/ directory for both controller annotations and Data subclasses. No path or namespace configuration needed — DTOs can live anywhere.
namespace App\DataObjects;
use Spatie\LaravelData\Data;
class UserData extends Data{ public function __construct( public int $id, public string $name, public string $email, public ?string $phone, public bool $is_active = true, ) {}}php artisan openapi:generateOutput: storage/api-docs/api-docs.json with a UserData schema containing all properties, types, defaults, and auto-generated example values.