- How do I install saloonphp/laravel-plugin in a Laravel app?
- Install the package with Composer using composer require saloonphp/laravel-plugin. Laravel package discovery should register the service provider automatically, then you can run php artisan saloon:install to publish initial configuration and set up the plugin. After that, use the Saloon Artisan commands to scaffold connectors and requests.
- What Laravel and PHP versions does saloonphp/laravel-plugin support?
- Current releases of saloonphp/laravel-plugin support modern Laravel versions, including Laravel 11 through 13, and PHP 8.1 through 8.5. Older 3.x releases support Laravel 10 and above, so check the package composer constraints before upgrading. Always confirm compatibility against your application's Laravel and PHP versions in composer.json.
- What Artisan commands does the Saloon Laravel plugin provide?
- The plugin provides Artisan tooling for setup and scaffolding, including saloon:install, saloon:connector, saloon:request, and saloon:list. These commands help you create Saloon connector and request classes and inspect the Saloon integrations in your application. This reduces boilerplate compared with creating API client classes manually.
- How do I publish and customize the Saloon Laravel plugin configuration?
- Publish the package configuration with Laravel's vendor:publish Artisan command or run php artisan saloon:install during setup. The configuration is then available as config/saloon.php, where you can adjust plugin behavior for your application. Commit the published config so environment-specific settings remain explicit and reviewable.
- How does saloonphp/laravel-plugin integrate with Laravel's service container?
- The plugin registers Saloon-related bindings in Laravel's service container, so connectors and supporting services can be resolved through dependency injection. This makes it easier to inject API clients into controllers, jobs, and services, and to swap or mock implementations in tests. It aligns Saloon's connector pattern with Laravel's normal container-based architecture.
- Can I mock Saloon API requests in Laravel tests with this plugin?
- Yes. Saloon supports request mocking and fake responses, and the Laravel plugin's container integration lets you resolve and substitute connectors cleanly in Laravel tests. You can assert outgoing requests and return controlled responses without calling real third-party APIs. This helps keep API integration tests fast and deterministic.
- Does saloonphp/laravel-plugin support Laravel Pulse and Telescope?
- Yes, the plugin includes Laravel-specific observability integrations, including Pulse monitoring and Telescope debugging support for Saloon requests. It also provides Nightwatch middleware for request and response inspection. These integrations help you trace API behavior while developing and monitor production traffic more effectively.
- Is saloonphp/laravel-plugin suitable for production Laravel applications?
- It is designed for production use and is actively maintained under the MIT license, with support for modern Laravel and PHP versions and Saloon v4. The main risks are normal dependency upgrades and adopting Saloon's connector/request pattern across your codebase. Pin Composer versions, test API integrations in CI, and validate behavior in staging before broad rollout.
- How is saloonphp/laravel-plugin different from using Saloon directly or Guzzle in Laravel?
- Saloon itself is a PHP HTTP client abstraction, while saloonphp/laravel-plugin adds official Laravel integration such as service container bindings, config publishing, Artisan scaffolding, and observability hooks. Guzzle is a lower-level HTTP client that gives you raw control but requires more custom structure for connectors, retries, and testing. The plugin is best when you want Saloon's contract-first API client pattern with Laravel-native tooling.
- How do I migrate existing Guzzle API clients to Saloon with this plugin?
- Migrate incrementally by wrapping existing API endpoints in Saloon connector and request classes rather than rewriting all clients at once. Use feature flags or configuration to run Saloon-based clients alongside legacy Guzzle implementations, and add tests for authentication, retries, and response handling. Once the new clients are stable, remove the old code path and update any HTTP mocks.