blitzr/php-client
Official PHP client for the Blitzr API. Install via Composer, authenticate with your API key, and access Blitzr resources like artists through a simple, lightweight client (e.g., getArtist). Includes docs and links to the API reference.
Response facade or custom formatters..env)? Are there risks of key leakage in logs or error responses?AppServiceProvider for global access:
$this->app->singleton(BlitzrClient::class, function ($app) {
return new BlitzrClient(config('services.blitzr.api_key'));
});
Blitzr facade to simplify usage (e.g., Blitzr::getArtist()).ArtistFetched) when data is retrieved.Http client to wrap the Blitzr client for consistency (e.g., middleware for logging, timeouts).$response = Http::withHeaders(['Authorization' => 'Bearer ' . config('services.blitzr.api_key')])
->get('https://api.blitzr.io/artists/' . $artistId);
Cache::remember()) to reduce API calls.getArtist, getTrack) with mock data.config/services.php to centralize the API key:
'blitzr' => [
'api_key' => env('BLITZR_API_KEY'),
'base_uri' => 'https://api.blitzr.io',
],
// routes/api.php
Route::get('/artists/{id}', [ArtistController::class, 'show']);
// app/Http/Controllers/ArtistController.php
public function show($id) {
$artist = app(BlitzrClient::class)->getArtist($id);
return response()->json($artist);
}
Log::debug).BlitzrApiException) for HTTP errors.spatie/fork or Laravel’s retry helper).composer.json to avoid unexpected updates:
"blitzr/php-client": "1.0.0"
Http::fake() to mock API responses in tests.BlitzrClient constructor option for debug mode).dd() or dump() for debugging responses in development.spatie/circuit-breaker) for Blitzr API downtime.interface BlitzrClientInterface {
public function getArtist(string $id);
}
delay(60) in Laravel Queues).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Blitzr API downtime | App features break | Circuit breakers, stale data caching |
How can I help you explore Laravel packages today?