Download the PHP package thesis/grpc-client without Composer

On this page you can find all versions of the php package thesis/grpc-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package grpc-client

thesis/grpc-client

Read-only subtree split from https://github.com/thesis-php/grpc.

Do not open issues/PRs here. Use the monorepo:

Async gRPC client for PHP with HTTP/2 transport, streaming RPCs, interceptors, TLS/mTLS, and client-side load balancing.

Contents

Installation

Requirements

To generate gRPC client classes from .proto, use:

Basic usage

You can pass request metadata too:

TLS and mTLS

Target addressing

The target string passed to withHost() follows gRPC name resolution format: scheme:endpoint.

Supported schemes:

Scheme Format Description
dns dns:///host:port or dns://authority/host:port Resolves hostname via DNS. Supports periodic re-resolution based on TTL.
ipv4 ipv4:addr1:port1,addr2:port2 Comma-separated IPv4 addresses, no DNS lookup.
ipv6 ipv6:[addr1]:port1,[addr2]:port2 Comma-separated IPv6 addresses in bracket notation.
unix unix:///path/to/socket Connects via Unix domain socket.
passthrough passthrough:///address Passes address through as-is without resolution.

If scheme is omitted, dns is assumed:

Use custom DNS server with authority:

Multi-endpoint target without DNS:

Load balancing

When resolution returns multiple addresses, the load balancer picks endpoint per RPC.

Built-in policies:

With DNS targets, resolver can re-resolve by TTL and call balancer refresh() with updated endpoints. Re-resolution interval is clamped between minimum and maximum bounds (default 30..300 seconds).

Custom load balancer example:

Endpoint resolution

Resolver is selected by target scheme. You can override the resolver for a scheme:

Default resolvers by scheme:

Custom schemes (service discovery)

Register a resolver under any scheme to plug in a service registry such as etcd or Consul. The target is then <scheme>://[authority]/<endpoint>, and the endpoint is handed to the resolver as $target->opaque:

An EndpointResolver returns the current Resolution and may push updates over time through EndpointResolverListener::onResolve(), which the balancer picks up live.

Error handling

Compression

Compression reduces payload size and is useful for large protobuf messages or bandwidth-constrained links.

Interceptors

Interceptors let you add cross-cutting logic (auth, logging, tracing, metadata enrichment) without changing service stubs. Mirroring gRPC, they come in two flavours, registered on separate chains:

A unary call does not run the stream chain and vice versa. An interceptor that must apply to both (e.g. auth) implements both interfaces and is registered on both chains.

Client streaming

Use client streaming when you need to send many messages and receive one final aggregated response.

Server streaming

Use server streaming when a single request should return a sequence of server messages.

Bidirectional streaming

Use bidirectional streaming for conversational protocols where both sides can send messages independently.

Closing the client

Call Client::close() to stop background resolver activity and release resources, especially when DNS re-resolution is enabled.


All versions of grpc-client with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
amphp/cache Version ^2.0
amphp/dns Version ^2.4
amphp/http Version ^2.1
amphp/http-client Version ^5.3
amphp/socket Version ^2.3
league/uri Version ^7.8
thesis/grpc-protocol Version ^0.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package thesis/grpc-client contains the following files

Loading the files please wait ...