dbp/relay-blob-library
PHP helper library for interacting with dbp relay-blob-bundle. Provides BlobApi for HTTP mode with optional OIDC authentication to add, fetch, and remove files (blobs) in a bucket, using simple BlobFile objects and identifiers.
HttpClient and dependency injection where needed.dbp/relay-blob-bundle, which is a Symfony bundle for blob storage. Laravel projects using external blob storage (e.g., S3, Azure Blob, or custom APIs) may find this useful for standardization.BlobFileApiInterface allows custom implementations (e.g., direct PHP SDKs or Laravel’s HTTP client), making it adaptable to non-Symfony ecosystems.HttpClient with minimal refactoring.league/oauth2-client) can replace the Symfony-based OIDC logic.BlobFileApiInterface) similarly to Symfony’s DI.HttpClient, Config). Laravel may require polyfills or replacements (e.g., symfony/http-client → Guzzle).BlobApiError class is Symfony-centric. Laravel’s exception handling (e.g., Illuminate\Support\MessageBag) may need adaptation.relay-blob-bundle (Symfony-specific) impact Laravel integration?spatie/laravel-medialibrary) that better fit the use case?symfony/http-client with Guzzle HTTP Client (Laravel’s default).BlobFileApiInterface to a custom implementation (e.g., HttpBlobApi).league/oauth2-client) for OIDC authentication.HttpClient with Guzzle in the library’s HTTP mode.// Laravel-compatible BlobApi implementation
class LaravelBlobApi implements BlobFileApiInterface {
use LaravelHttpClientTrait; // Custom trait wrapping Guzzle
public function addFile(BlobFile $blobFile): BlobFile {
$response = $this->httpClient->post($this->blobBaseUrl, [
'multipart' => [
'file' => fopen($blobFile->getFile()->getPathname(), 'r'),
'filename' => $blobFile->getFilename(),
],
]);
// Parse response...
}
}
league/oauth2-client for OIDC:
$provider = new \League\OAuth2\Client\Provider\GenericProvider([
'clientId' => $oidcClientId,
'clientSecret' => $oidcClientSecret,
'urlAuthorize' => $oidcProviderUrl . '/authorize',
'urlAccessToken' => $oidcProviderUrl . '/token',
]);
$token = $provider->getAccessToken('client_credentials');
$this->httpClient->withToken($token);
AppServiceProvider:
$this->app->bind(BlobFileApiInterface::class, function ($app) {
return new LaravelBlobApi(
$app['config']['blob.bucket_identifier'],
$app['config']['blob.bucket_key'],
// ...
);
});
POST/PATCH/DELETE. Laravel’s HTTP client supports these natively.SplFileInfo, StreamInterface, and strings. Laravel’s Storage facade or Illuminate\Http\UploadedFile can adapt inputs.BlobApiError exceptions can be mapped to Laravel’s Illuminate\Http\JsonResponse or Illuminate\Validation\ValidationException.BlobFileApiInterface implementation.getSignedUrl, deleteFilesByPrefix) work in Laravel.dbp/relay-blob-bundle for breaking changes (Symfony-specific). Laravel may require forks or polyfills.BlobApiError exceptions need logging integration (e.g., Laravel’s Log facade or Sentry).dd() or debugbar for debugging.throttle) for API rate limits.Cache facade.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Blob API downtime | File operations fail | Retry logic (Laravel’s retry helper) + fallback to local storage. |
| OIDC token expiration | Auth failures | Implement token refresh in Laravel’s OAuth2 client. |
| Large file uploads | Memory/timeouts | Use Laravel’s Storage::disk()->putFileAs() or chunked uploads. |
| Inconsistent metadata | Data corruption | Validate checksums (library supports this). |
| Laravel cache invalidation | Stale signed URLs | Short-lived signed URLs (e.g., 15-minute expiry). |
HttpClient).How can I help you explore Laravel packages today?