Skip to content

CLI

PHP Configuration Options

This section details the available configuration options for the PHP SDK. All configuration is managed in the gen.yaml file under the php section.

php:
version: 1.2.3
packageName: "openapi/openapi"
namespace: "OpenAPI\\OpenAPI"
Name
version
Required
true
Description
The current version of the SDK.
Default Value
0.0.1
packageName
Required
true
Description
The name of the composer package. See Composer Package Naming.
Default Value
openapi/openapi
namespace
Required
true
Description
The namespace for the package. See PHP Namespace Documentation.
Default Value
OpenAPI\OpenAPI
php:
maxMethodParams: 4
Name
Required
false
Description
Sets the maximum number of parameters before an input object is created. 0 means input objects are always used.
Default Value
4
php:
flattenGlobalSecurity: true
Property
Description
Enables inline security credentials during SDK instantiation. Recommended: true
Default
true
Type
boolean
php:
imports:
option: "openapi"
paths:
callbacks: models/Callbacks
errors: models/Errors
operations: models/Operations
shared: models/Components
webhooks: models/Webhooks
Field
option
Required
false
Description
Defines the type of import strategy. Typically set to "openapi", indicating that the structure is based on the OpenAPI document.
Default Value
"openapi"
paths
Required
false
Description
Customizes where different parts of the SDK (e.g., callbacks, errors, operations) will be imported from.
Default Value
{}
Component
callbacks
Default Value
models/callbacks
Description
The directory where callback models will be imported from.
errors
Default Value
models/errors
Description
The directory where error models will be imported from.
operations
Default Value
models/operations
Description
The directory where operation models (i.e., API endpoints) will be imported from.
shared
Default Value
models/components
Description
The directory for shared components, such as reusable schemas, and data models imported from the OpenAPI spec.
webhooks
Default Value
models/webhooks
Description
The directory for webhook models, if the SDK includes support for webhooks.
php:
clientServerStatusCodesAsErrors: true
responseFormat: "flat"
enumFormat: "enum"
Name
clientServerStatusCodesAsErrors
Required
false
Description
Whether to treat 4XX and 5XX status codes as errors.
Default Value
true
Required
false
Description
Defines how responses are structured. Options: envelope, envelope-http, or flat.
Default Value
flat

When a PHP SDK is used within a Laravel application, Speakeasy is able to generate the needed Service Provider code to support seamless integration.

…all of Laravel’s core services, are bootstrapped via service providers.

But, what do we mean by “bootstrapped”? In general, we mean registering things, including registering service container bindings, event listeners, middleware, and even routes. Service providers are the central place to configure the application.

To enable the Laravel Service Provider generation, update the gen.yaml configuration setting enabled to true, and set svcName appropriately.

php:
laravelServiceProvider:
enabled: true
svcName: "openapi"
Field
laravelServiceProvider
Required
false
Description
Configure the generation of the Service Provider.
Default Value
{}
Field
enabled
Required
false
Description
Set to true to enable Service Provider generation.
Default Value
false
svcName
Required
false
Description
The name to be used for the service provider.
Default Value
"openapi"
php:
additionalDependencies: {
"autoload": {
"OpenAPI\\OpenAPI\\Lib\\": "lib/"
},
"autoload-dev": {
"OpenAPI\\OpenAPI\\Test\\": "Tests/"
},
"require": {
"firebase/php-jwt": "^6.10",
"phpseclib/phpseclib": "^3.0"
},
"require-dev": {
"monolog/monolog": "^3.0"
}
}
Field
additionalDependencies
Required
false
Description
Adds additional dependencies and autoload mappings to the generated composer.json file.
Default Value
{}
Name
autoload
Required
false
Description
Defines autoload mappings for the autoload.psr4 section.
Default Value
{}
autoload-dev
Required
false
Description
Defines autoload mappings for the autoload-dev.psr4 section (for development and testing).
Default Value
{}
require
Required
false
Description
Adds additional dependencies to the require section.
Default Value
{}
require-dev
Required
false
Description
Adds additional dependencies to the require-dev section (for development and testing).
Default Value
{}