google/longrunning
Idiomatic PHP client for Google’s LongRunning Operations API. Install via Composer, supports REST and optional gRPC for streaming, and integrates with Google Cloud PHP authentication and debugging guides. Beta but largely stable.
ShouldQueue). It can be wrapped in a facade or service class to abstract GCP-specific logic, aligning with Laravel’s architectural patterns.BigQuery job via a Laravel job, then poll its status in the same queue).ext-grpc dependency) or gRPC for high-throughput scenarios (e.g., >100 concurrent operations), fitting Laravel’s scalability needs.google/cloud-storage integration patterns).dispatch() to offload LRO management to background workers (e.g., BigQueryJob::dispatch()->onQueue('gcp')).ext-grpc (PHP extension), adding a runtime dependency. REST is a viable fallback.0.7.1) and monitoring Google’s release notes.Google\ApiCore\ApiException) may need wrapping to align with Laravel’s exception handling (e.g., throw new \RuntimeException()).progress, error) be logged to Laravel’s log() or a dedicated GCP stackdriver?GoogleLongRunningClient) with authenticated credentials.GcpOperation facade for clean syntax (e.g., GcpOperation::poll($operationName)).Job class to support GCP LROs (e.g., GcpJob with pollUntilDone())..env for service account keys.$client = new Google\LongRunning\LongRunningClient([
'credentials' => (new Google\Auth\Credentials\ServiceAccountCredentials([
'keyFile' => storage_path('app/gcp-service-account.json'),
])),
]);
composer require grpc/grpc and configure ClientOptions for performance-critical paths.while loop checking BigQuery job status) with the google/longrunning client.// Before (ad-hoc)
while (true) {
$job = $bigQuery->jobs->get($project, $jobId);
if ($job['status']['state'] === 'DONE') break;
sleep(5);
}
// After (using google/longrunning)
$operation = $longRunningClient->getOperation($name);
$operation->pollUntilDone();
composer.json and test in a staging environment.GoogleLongRunningClient via constructor).GcpOperation::cancel($operationName)).google/auth and google/api-core (included via google/longrunning).ext-grpc is installed:
pecl install grpc
Google\Cloud\LongRunning\V1\LongRunningClient → Google\LongRunning\LongRunningClient)..env or secure storage.AppServiceProvider and bind it to the container.GcpJob base class).google/longrunning for breaking changes (beta status).composer.json (e.g., ^0.7) to avoid surprises.ClientOptions) in a config file (e.g., config/gcp.php).GcpOperationException).try {
$operation->pollUntilDone();
} catch (Google\ApiCore\ApiException $e) {
throw new GcpOperationException($e->getMessage(), $e->getCode(), $e);
}
Log::debug().$client = new LongRunningClient([
'logger' => new \Google\ApiCore\Logging\Logger(
new \Monolog\Logger('grpc')
),
]);
gcp-bigquery, gcp-compute) to isolate workloads.BigQueryJob::dispatch()->onQueue('gcp-bigquery');
| **
How can I help you explore Laravel packages today?