bardiz12 / swoole-grpc
GRPC abstraction for swoole to build high performance polygloat services
Installs: 3
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 15
pkg:composer/bardiz12/swoole-grpc
Requires
- php: >=8.1
- ext-swoole: >=6.0.0
- psr/container: ^2.0
- psr/log: ^3.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.6
- google/protobuf: ^4.32
- phpunit/phpunit: ^9.5
- swoole/ide-helper: ^5.1
- vimeo/psalm: ^4.6
Suggests
- ext-swoole: *
- google/protobuf: ^3.21
This package is auto-updated.
Last update: 2025-11-17 13:34:07 UTC
README
This library is a forked version of the original OpenSwoole gRPC library, designed specifically for use with the Swoole PHP Extensions. It provides a modern, high-performance, and coroutine-friendly gRPC server and client implementation for PHP, enabling scalable microservices and efficient inter-service communication. Thanks to
About
Swoole gRPC brings native gRPC support to PHP applications running on Swoole. It is a drop-in, improved, and actively maintained alternative to the OpenSwoole gRPC library, with a focus on code quality, extensibility, and developer experience.
This library is suitable for:
- Building high-performance PHP microservices with gRPC
- Integrating PHP with polyglot (multi-language) gRPC systems
- Leveraging Swoole's coroutine and async features for scalable RPC
Features
- Native gRPC protocol implementation (HTTP/2, Protobuf)
- Coroutine-based server and client for maximum concurrency
- Server-side streaming and unary RPC support
- Client connection pooling and multiplexing
- Middleware/interceptor support for authentication, logging, etc.
- Easy integration with generated PHP stubs from
.protofiles
Installation
Install via Composer:
composer require bardiz12/swoole-grpc
Note: Requires the Swoole PHP Extension v6.0.0 or above to be installed and enabled.
TODO
- Create example usage of this library
- Initialize Unit Tests
- Handle Multiple HTTP Protocol handler (so we can just allocate 1 Swoole Server fot HTTP/1.1 and HTTP/2.0)
- Handle Stream Request
- Refactor Client Pool
Getting Started
- Define your service in a
.protofile - Generate PHP stubs using protoc-gen-swoole-grpc or compatible tools
- Implement your service logic using the generated classes
- Start the gRPC server using Swoole
- Connect with a gRPC client (PHP or any other language)
Documentation
- Refer to the Swoole documentation for server setup and coroutine usage
License
MIT. See LICENSE.