boson-php/http-static-provider
Laravel/PHP package that provides a static HTTP provider for Boson, useful for serving fixed responses in tests, mocks, or offline scenarios. Simple setup to return predefined status, headers, and body without making real network requests.
Guzzle, Symfony HTTP Client, or Illuminate\Http\Client in Laravel).Illuminate\Support\Facades\Http) via custom resolvers or service providers.Http::fake()) but offers static response flexibility (e.g., predefined JSON/XML files).Psr\Http\Message\ResponseFactory) or custom adapters.config/http.php or via a service provider.boson-php/boson for core functionality).Http facade or testing helpers (e.g., Http::fake()).Http::fake() for critical paths; reserve this package for static use cases.BosonHttpServiceProvider).Http::fake()?Http::fake() entirely, or supplement it for specific scenarios?boson-php/boson’s roadmap?Http::fake() (built-in).vcr-php/vcr (record/replay).mockery/php-mock for lower-level HTTP mocking.Illuminate\Support\Facades\Http for static responses.app()->bind('staticHttpClient', fn() => new BosonStaticProvider())).Http::get('https://api.stripe.com/...') with a static provider.// app/Providers/BosonServiceProvider.php
public function register()
{
$this->app->singleton('boson.static.provider', fn() => new \Boson\Http\StaticProvider());
Http::macro('static', fn() => Http::withOptions(['handler' => app('boson.static.provider')]));
}
// config/http.php
'defaults' => [
'handler' => \Boson\Http\StaticProvider::class,
],
Http::fake() with the static provider for targeted tests.// Before: Http::fake(['*'], fn($request) => Http::response(['data' => 'test']));
// After: Http::static()->respondWith(['data' => 'test']);
Http::fake() for dynamic cases, reserve this package for static ones.Http::asJson(), Http::acceptJson()).Http facade methods.Http::fake() calls in critical test suites.Http::fake().Http::fake() or mockery if the package fails to meet needs.Http::async() for those).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Package lacks Laravel facade support | Manual HTTP client setup required | Create a wrapper facade/class. |
| Static responses don’t match real API | Tests fail in production | Use Http::fake() for critical paths. |
| Undocumented request/response rules | Unpredictable |
How can I help you explore Laravel packages today?