This is the fastest path from OpenAPI file to framework-ready server code.
Generate typed models plus server API contracts/glue, then implement your business logic in generated interfaces.
<?php
declare(strict_types=1);
use MaxBeckers\OpenApiGenerator\Config\FrameworkTarget;
use MaxBeckers\OpenApiGenerator\Config\GenerationTarget;
use MaxBeckers\OpenApiGenerator\Config\GeneratorConfig;
$config = new GeneratorConfig();
$config->specFile = 'openapi.yaml';
$config->outputDir = 'generated';
$config->modelNamespace = 'App\\Model';
$config->modelOutputDir = 'Model';
$config->apiNamespace = 'App\\Api';
$config->apiOutputDir = 'Api';
$config->generationTarget = GenerationTarget::Server;
$config->frameworkTarget = FrameworkTarget::Symfony; // or FrameworkTarget::Laravel
return $config;
vendor/bin/openapi-gen
*ApiInterface methods.openapi.yaml changes.FrameworkTarget::None: contracts only (*ApiInterface)FrameworkTarget::Symfony: adds controller actions with route attributesFrameworkTarget::Laravel: adds controller actions and *ApiRoutes helperSee also: Framework Targets.