Speakeasy Logo
Skip to Content

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.

Version and general configuration

Name
version
Required
true
Default Value
0.0.1
Description
The current version of the SDK.
packageName
Required
true
Default Value
openapi/openapi
Description
The name of the composer package. See Composer Package Naming .
namespace
Required
true
Default Value
OpenAPI\OpenAPI
Description
The namespace for the package. See PHP Namespace Documentation .

Method and parameter management

Name
maxMethodParams
Required
false
Default Value
4
Description
Sets the maximum number of parameters before an input object is created.
means input objects are always used.

Security configuration

Property
flattenGlobalSecurity
Description
Enables inline security credentials during SDK instantiation. Recommended:
Type
boolean
Default
true

Import management

Field
option
Required
false
Default Value
"openapi"
Description
Defines the type of import strategy. Typically set to
, indicating that the structure is based on the OpenAPI document.
paths
Required
false
Default Value
{}
Description
Customizes where different parts of the SDK (e.g., callbacks, errors, operations) will be imported from.

Import paths

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.

Error and Response Handling

Name
clientServerStatusCodesAsErrors
Required
false
Default Value
true
Description
Whether to treat 4XX and 5XX status codes as errors.
responseFormat
Required
false
Default Value
flat
Description
Defines how responses are structured. Options:
,
, or
.

Laravel service provider

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.

Field
laravelServiceProvider
Required
false
Default Value
{}
Description
Configure the generation of the Service Provider.

Laravel service provider configuration

Field
enabled
Required
false
Default Value
false
Description
Set to true to enable Service Provider generation.
svcName
Required
false
Default Value
"openapi"
Description
The name to be used for the service provider.

Additional dependencies

Field
additionalDependencies
Required
false
Default Value
{}
Description
Adds additional dependencies and autoload mappings to the generated
file.

Additional dependencies configuration

Name
autoload
Required
false
Default Value
{}
Description
Defines autoload mappings for the
section.
autoload-dev
Required
false
Default Value
{}
Description
Defines autoload mappings for the
section (for development and testing).
require
Required
false
Default Value
{}
Description
Adds additional dependencies to the
section.
require-dev
Required
false
Default Value
{}
Description
Adds additional dependencies to the
section (for development and testing).

Last updated on