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

v0.0.1 2025-11-17 13:18 UTC

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 .proto files

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

  1. Define your service in a .proto file
  2. Generate PHP stubs using protoc-gen-swoole-grpc or compatible tools
  3. Implement your service logic using the generated classes
  4. Start the gRPC server using Swoole
  5. Connect with a gRPC client (PHP or any other language)

Documentation

License

MIT. See LICENSE.