Download the PHP package utopia-php/nats without Composer

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

nats.php

[!IMPORTANT] This repository is a read-only mirror of the utopia-php monorepo. Development happens in packages/nats — please open issues and pull requests there.

A modern PHP client for NATS messaging system with JetStream and Key-Value store support.

Requirements

Installation

Quick start

Core NATS

Connecting

Publishing

Subscribing

Request-reply

Connection management

JetStream

Streams

Publishing with acknowledgment

Publishing a batch

publish() waits for each acknowledgment before it sends the next message, so a batch of N messages costs N round trips. publishMany() writes a window of messages first and reads their acknowledgments afterwards, which costs one round trip per window. Each message keeps its own acknowledgment, so deduplication and per-message errors work the same way.

The window argument sets how many messages stay in flight before their acknowledgments are collected. A message the server rejects throws, as it does on publish().

Consumers

Key-value store

Authentication

TLS

Event callbacks

Testing

Batched requests

Connection::requestBatch() sends independent requests together and delivers each outcome to reply as it arrives. The callback receives the original input index and either a Message or a Throwable. One missing reply does not delay successful replies or discard their outcomes.

Request has read-only typed fields; both request() and requestBatch() use its subject validation and the same request lifecycle. The method returns void; collect results in the callback if you need an array. Completion order can differ from input order. The timeout is one response deadline for the whole group, starting after the write, rather than a separate wait per reply. Callback execution counts toward that deadline. Empty input performs no I/O. Invalid input throws before any request is published; request headers and payload limits follow request().

If the callback throws, collection stops immediately, pending state is cleaned up, and the exception propagates. Requests already sent are not cancelled or replayed. Later replies can still arrive. Use one owner for reading the connection; nested reads from the callback throw LogicException.

This differs from requestMany(), which sends one request and gathers several responses. Ambiguous writes are not replayed on reconnect. Use JetStream::ackBatch() to confirm a selected list of JetStreamMessage instances. JetStream constructs each acknowledgement; its callback receives the original index and null on server confirmation or a Throwable on failure. The consumer's configured acknowledgement policy still applies. Use AckPolicy::Explicit to leave messages outside the list unacknowledged. With AckPolicy::All, acknowledging a later message also acknowledges earlier messages, including those outside the list.

Single request() calls retain one retry for an explicit stale-connection rejection. Batch requests do not retry. Neither path replays an ambiguous write.

License

Apache-2.0


All versions of nats with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
ext-json Version *
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 utopia-php/nats contains the following files

Loading the files please wait ...