Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Grpc Client

Grpc Client Laravel Package

spiral/grpc-client

Powerful, extensible PHP gRPC client with a simple Guzzle-like API. Supports standalone use or Spiral integration, configurable via DTOs, includes common interceptors (timeouts, retries) and dedicated exceptions. Requires the PHP gRPC extension.

View on GitHub
Deep Wiki
Context7

PHP client for gRPC

Frequently asked questions about Grpc Client
Can I use spiral/grpc-client in Laravel without Spiral Framework?
Yes, the package supports standalone usage. Register the `GrpcClient` via Laravel’s service provider or manually instantiate it. Interceptors and DTO-based config work identically in both Spiral and Laravel. Just ensure the PECL gRPC extension is installed.
How do I install and configure spiral/grpc-client in Laravel?
Run `composer require spiral/grpc-client`, then register the client in a service provider using `app->singleton(GrpcClient::class, fn() => GrpcClient::create(config('grpc.connections')))`. Configure endpoints, interceptors, and timeouts in `config/grpc.php`.
What Laravel versions does spiral/grpc-client support?
The package is framework-agnostic but works with Laravel 8.x–10.x. Ensure your PHP version (8.1+) matches Laravel’s requirements. Spiral’s core dependencies (like gRPC) are version-agnostic for Laravel.
How do I handle gRPC errors in Laravel exceptions?
Use the package’s dedicated exceptions (e.g., `GrpcException`, `StatusException`) and catch them in Laravel’s exception handler. Map gRPC status codes (e.g., `UNAVAILABLE`) to Laravel’s `HttpException` or custom exceptions for consistency.
Does spiral/grpc-client support retries and timeouts?
Yes, use built-in interceptors like `RetryInterceptor` and `SetTimeoutInterceptor`. Configure them via `withInterceptors()` or DTO factories. For example, `RetryInterceptor::createConfig(maximumAttempts: 3)` retries failed calls up to 3 times.
How do I generate gRPC service interfaces for PHP?
Use `protoc` with the PHP gRPC plugin: `protoc --php_out=. --grpc_out=. --plugin=protoc-gen-grpc=$(which grpc_php_plugin) api.proto`. Store generated `.php` files in your project and version-control them or auto-generate them in CI.
What’s the best way to log gRPC calls in Laravel?
Create a custom interceptor (e.g., `LogInterceptor`) that injects Laravel’s `Log` facade. Log requests/responses in the interceptor’s `handle()` method. Example: `Log::info('gRPC call', ['method' => $method, 'response' => $response])`.
Can I use spiral/grpc-client with Laravel queues or Horizon?
No, the package doesn’t natively integrate with Laravel queues. gRPC calls are synchronous by design. For async workflows, dispatch a job that calls the gRPC client, then return a queueable response.
What are the deployment challenges with the PECL gRPC extension?
The extension requires PECL installation (e.g., `pecl install grpc`). For Docker, use a base image with PHP + gRPC pre-installed (e.g., `php:8.2-cli` with `RUN pecl install grpc`). Test locally with `php -m | grep grpc` to verify.
Are there alternatives to spiral/grpc-client for Laravel?
For Laravel, consider `grpc/grpc` (low-level) or `reactphp/grpc` (async). For Spiral, `spiral/grpc-client` is optimized. If you need Guzzle-like simplicity, this package bridges that gap for gRPC. Alternatives lack Laravel integration or interceptor flexibility.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope