Download the PHP package rapira/contract without Composer

On this page you can find all versions of the php package rapira/contract. 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 contract

rapira/contract

PHP-side contract for Rapira, a PHP application server written in Rust. PHP is embedded in the server process — no FastCGI, no sockets, no serialization. This package declares the types that boundary speaks; the extension provides the objects.

Requires PHP 8.4 — the extension's floor; the stubs themselves use nothing newer than 8.2. Execution modes form a ladder — Rapira\Mode, read back at runtime from get_mode(): Classic boots the script per request, Worker boots it once and serves requests one after another through the SAPI superglobals, Dispatcher takes requests as units of work through this contract — one at a time or concurrently on fibers. Only Dispatcher mode has a dispatcher; everything below lives on that rung.

Contract

Plugins narrow receive() natively and add their own finalization verbs. Each plugin's surface, and the reasoning behind its shape, lives beside its stubs:

Rules

Exceptions

Rapira\Exception\TimeoutException and Rapira\Exception\ClosedException are both caught routinely — the first by a loop doing periodic chores, the second as the loop's exit — so both need types. They extend the SPL class that fits (\RuntimeException) and implement the Rapira\Exception\RapiraThrowable marker, so "anything from Rapira" is catchable without forcing every error into one hierarchy. The marker is named for what it spans: the \Error classes below implement it too, which makes it a supervisor's catch at the top of the worker, never a handler's.

AlreadyFinalizedError extends \Error — nobody catches it, the script fatals, the host cleans up. Not \LogicException, which frameworks catch broadly enough to swallow it. The error/exception split is left to the native hierarchy, so instanceof \Error keeps meaning "your code is wrong" and no second marker is needed for it. NoDispatcherError and NotInWorkerModeError are the same shape: a script asking for a dispatcher or for the next request in a mode that does not provide it is wrong by construction.

WorkDiscardedException is finalizing a unit the host had already closed — expired deadline, drain, gone client, lease lost to another worker. The worker broke no rule, so it is a runtime exception and not an error, and a handler catches it to log the loss. Polling Work::isCancelled() at checkpoints avoids getting there at all.

Not in the contract

Omitted Why
PluginHandlerConfig, create_plugin_handler($config) second source of truth for what rapira.toml owns
PluginInterface above Dispatcher a parent interface is extractable later at zero BC cost
@template-covariant generics native return-type covariance already does this, engine-checked
isAlive() the exit condition needs one source; while ($d->isAlive()) around a blocking call is wrong by construction
concurrency(): int blocking is the backpressure; the effective limit is the min of both sides, unexchanged
inFlight() as an exit condition host counts unfinalized units, SDK counts live handlers — different numbers; as a DispatcherInfo counter it is fine
LifecycleException several units in flight is the normal case, not a violation
receiveMany() latency poison for request traffic; batching is plugin vocabulary
backing values on LogLevel the host matches cases, so no string is on the wire — and without tryFrom() a PSR-3 bridge cannot half-map: tryFrom($level) ?? Info would file every emergency under Info
CN, SAN and issuer on Tls, or a field per certificate attribute fingerprint pinning covers mTLS identity, and Pingora's SslDigest exposes nothing more (pingora#421). When names are needed, the addition is one certPem field with the whole certificate — openssl_x509_parse() reads every attribute in userland

Open

  1. Non-dispatcher plugins. A logger richer than log() — its own target, its own sink — or a KV client is not a stream of work units and needs a second acquisition path, without bringing back config objects.

References


All versions of contract with dependencies

PHP Build Version
Package Version
Requires php Version ^8.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 rapira/contract contains the following files

Loading the files please wait ...