crescat-io/saloon-sdk-generator
Generate PHP SDKs from OpenAPI specs with Saloon. Turn API definitions into typed connectors, requests, and resources, reducing boilerplate and helping you ship consistent client libraries faster.
The Saloon SDK Generator is a CLI tool that turns OpenAPI specs into ready-to-use Saloon connectors, requests, and DTOs. Install it globally, then generate your first SDK from a spec:
composer global require crescat-io/saloon-sdk-generator
saloon-sdk-generator generate --spec=openapi.yaml --output=app/Services/MyApi
Start by reading the generated Connector class and the package’s config file (publish with vendor:publish --tag=saloon-sdk-generator-config). Your first use case should be a read-only API call: generate an SDK, inject the connector into a controller or artisan command, and call a generated request. This validates the spec, namespace, and auth wiring before you invest in customization.
defaultAuth() in your connector; v1.6.0 now consistently uses defaultAuth() instead of getAuthenticator(), so custom authenticators should override defaultAuth().MockClient / RecordedResponse in feature tests. Generate SDKs into a tests/Fixtures namespace when you need to assert generated behaviour without polluting app code.defaultAuth() for the default path.saloonphp/saloon ^4.0 and saloonphp/laravel-plugin ^4.0. Generated SDKs accept ^3.0|^4.0, but you should upgrade your app to Saloon v4 to pick up the CVE fixes. Check your composer.lock for transitive constraints.getAuthenticator() in a multi-auth connector, verify your custom connector defines defaultAuth(). Behaviour is now consistent with single-authenticator connectors.require-dev and run it via vendor/bin/saloon-sdk-generator for reproducible generation.composer dump-autoload. If generated classes are not found, check composer.json PSR-4 mappings and the generator’s --namespace option.Debugger or --debug flag in the generated connector, and inspect the generated request’s resolveEndpoint() and defaultBody() methods. Most spec-to-SDK issues surface there.saloon-sdk-generator.php), and post-generation hooks are the safest places to customize. Avoid patching vendor files; the global install will be replaced on upgrade.How can I help you explore Laravel packages today?