Download the PHP package cleatsquad/php-grpc-frame-codec without Composer

On this page you can find all versions of the php package cleatsquad/php-grpc-frame-codec. 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 php-grpc-frame-codec

php-grpc-frame-codec

Tests

The 5-byte gRPC message frame your PHP backend must send back to franken-grpc — extracted into a tiny, dependency-free package so every backend integrating with the relay doesn't have to hand-roll it.

Not tied to FrankenPHP. Despite the name of the relay it was built for, this package is pure byte manipulation (pack()/unpack()) with no runtime dependency at all. It works identically under nginx+PHP-FPM, Apache+mod_php, RoadRunner, Swoole, plain php-fpm, or FrankenPHP — the only thing that matters is that something in front of your backend speaks the same 5-byte frame (franken-grpc does; anything reusing its wire contract would too).

Why this exists

franken-grpc's contract is asymmetric: the request your backend receives is raw protobuf, no envelope (the relay already stripped it converting the incoming HTTP/2 gRPC call into a plain HTTP/1.1 POST) — but the response you send back must carry the standard gRPC frame:

Getting this wrong produces no clean error on either side — just a frame declares compression flag N, compressed frames are not supported by this relay from the relay, once you happen to send the request-side framing back by mistake. This package exists so that byte-level detail is written once, tested, and reused instead of copy-pasted per project.

Install

Usage

decode() is provided for symmetry and for tests — most backends never need to call it, since franken-grpc already strips the frame on the request side.

Server-streaming responses

A server-streaming RPC emits several frames back-to-back in the same HTTP response. If you're reading the body incrementally (chunked output, fwrite/flush per message, or a client consuming the response as a stream) you may not have a full frame yet on a given read. readNextFrame() handles that: it consumes one frame from the front of $buffer and advances it past what it read, returning null — without touching $buffer — when the frame isn't complete yet.

For a response you already have in full (the common unary case), decode() remains the simpler one-shot call.

Examples by PHP runtime

The snippet above works as-is under any of these — only the entry point changes.

nginx + PHP-FPM

Apache + mod_php

Identical to the nginx example — mod_php is just another SAPI calling the same index.php. Route /{package}.{Service}/{Method} to it with a RewriteRule, the same way you would for any front-controller pattern.

RoadRunner

FrankenPHP

License

MIT — see LICENSE.


All versions of php-grpc-frame-codec with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
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 cleatsquad/php-grpc-frame-codec contains the following files

Loading the files please wait ...