superbrave/verbose-error-http-client
A Laravel HTTP client wrapper that turns failed API requests into verbose, readable exceptions with status codes, headers, and response bodies, making third-party integrations easier to debug and fix.
composer require superbrave/verbose-error-http-client
composer.json constraints first. Release 2.2.0 moves the Symfony/Anamnesis dependency line from 7.4.* to 8.x; confirm your Laravel/Symfony component versions are compatible before upgrading.README.md for the intended client/exception usage.Minimal Laravel-style usage:
use Superbrave\VerboseErrorHttpClient\VerboseErrorHttpClient;
$client = app(VerboseErrorHttpClient::class);
try {
$response = $client->request('GET', 'https://api.example.com/users');
} catch (\Throwable $e) {
report($e); // or log the verbose message locally
}
If the package exposes an interface/contract, bind it in a service provider and inject that instead of constructing the client directly.
Http::fake() or Symfony mock responses to assert that failed responses produce useful exception messages without hitting real APIs.Example binding:
// AppServiceProvider::register()
$this->app->bind(
\Superbrave\VerboseErrorHttpClient\VerboseErrorHttpClient::class,
fn ($app) => new \Superbrave\VerboseErrorHttpClient\VerboseErrorHttpClient()
);
Example service usage:
final class UserApi
{
public function __construct(private VerboseErrorHttpClient $client) {}
public function find(int $id): array
{
$response = $this->client->request('GET', "https://api.example.com/users/{$id}");
return $response->toArray();
}
}
2.2.0 is mainly a dependency upgrade. Treat it as potentially breaking if your app still requires Symfony 7.4.* components. Run composer why-not superbrave/verbose-error-http-client 2.2.0 if the update is blocked.php artisan config:clear locally and php artisan config:cache in deployment after changing config.How can I help you explore Laravel packages today?