jetcamp/laravel-json-api-client
Laravel package for consuming JSON:API services from your app. Provides a client layer to send requests and handle resources/relationships in a JSON:API-compatible way, aiming to simplify integration with external APIs.
Http facade.JsonApiClientRequesting, JsonApiClientResponded) for observability.Illuminate\Support\Facades\RateLimiter).Http client for flexible JSON.)422 Unprocessable Entity) requiring custom exception mapping?filp/whoops or graphql-php instead).Http client + manual JSON parsing).Http::get() calls with JsonApiClient for 1–2 APIs.composer.json constraints (e.g., illuminate/http).bootstrap/app.php).guzzlehttp/guzzle (if using Laravel’s default HTTP client).symfony/http-client (if custom client is configured).JsonApiClientContract) to isolate the package.composer require jetcamp/laravel-json-api-client.config/services.php and bind the client to the container:
$this->app->singleton(JsonApiClient::class, function ($app) {
return new JsonApiClient('https://api.example.com', [
'auth' => ['token' => $app['auth']->user()->token],
]);
});
app/Services/StripeClient.php) to abstract package details.JsonApiClientResponded event).config/services.php or environment files).Http client features).composer.json to avoid surprises.JsonApiResponse class.401 Unauthorized").Sentry or Laravel Debugbar to log API client interactions.Illuminate\Support\Facades\Cache for idempotent requests.k6 or Artillery to identify bottlenecks.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Package abandonment | Broken dependencies, security risks | Fork and maintain; set up GitHub watch alerts. |
| API schema changes | Client breaks on new fields | Use JsonApiClient::withFields() dynamically. |
| Network timeouts | Slow responses block requests | Add retry logic with Illuminate\Support\Facades\Retry. |
| Authentication failures | Unauthorized requests | Implement fallback to manual HTTP client. |
| JSON:API spec violations | Malformed responses | Validate responses with jsonapi-php/validator. |
Mockery or `PestHow can I help you explore Laravel packages today?