Skip to content
Nav

Install

composer require langsys/openapi-docs-generator
Packagist version Monthly downloads License PHP 8.1+ Laravel 10 / 11
  1. Require the package:

    Terminal window
    composer require langsys/openapi-docs-generator
  2. Publish the config:

    Terminal window
    php artisan vendor:publish --provider="Langsys\OpenApiDocsGenerator\OpenApiDocsServiceProvider" --tag=config

    This creates config/openapi-docs.php.

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,
) {}
}
Terminal window
php artisan openapi:generate

Output: storage/api-docs/api-docs.json with a UserData schema containing all properties, types, defaults, and auto-generated example values.

Feedback