Download the PHP package thesis/nats without Composer

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

Thesis Nats

Pure non-blocking (fiber based) strictly typed full-featured PHP driver for NATS.

Features

Installation

Nats Core

The library implements the full functionality of NATS Core, including pub-sub, queues and request–reply.

Pub-Sub

Queues

Request-reply

Nats JetStream

JetStream is the built-in NATS persistence system. The library provides both JetStream entity management (streams, consumers) and message publishing/consumption capabilities.

Fetch Batch

You can request a specific number of messages at once using PullConsumer::fetch with FetchConfig::batch(number_of_messages). For example:

You can also configure the batch retrieval timeout and heartbeat settings using FetchConfig::maxWait and FetchConfig::heartbeat parameters.

Fetch Bytes

If you want to retrieve a batch of a specific size in bytes, you can use FetchConfig::bytes(byte_size):

And you can also configure the timeout and heartbeat settings.

Fetch Immediate

If you simply want to retrieve a batch of messages currently available in the stream, use FetchConfig::immediate():

Push Consumer

NATS offers two message delivery models: pull and push. Although the NATS documentation recommends the pull approach, for most PHP use cases push consumers are often preferable. Similar to RabbitMQ, push consumers can be configured to avoid negative impacts on both the consumers and the messages themselves. Key configuration parameters include maxAckPending, which limits the number of unacknowledged messages NATS will deliver before waiting (analogous to prefetch count in RabbitMQ), and the ackPolicy. This setup allows you to scale message processing by increasing the number of consumers and distribute messages among them more evenly.

For example, if you want to process messages one by one with explicit acknowledgments, you would set maxAckPending=1 and ackPolicy=explicit.

Additionally, for push consumers, the deliverSubject parameter is mandatory, as it is this very parameter that distinguishes the push model from pull.

If you want to distribute messages from a single consumer across different subscriptions, you should use the deliverGroup parameter. This enables you to scale processing across multiple consumer instances. This parameter functions identically to queueGroup in NATS Core.

Please refer to the push consumer configuration documentation to understand the purpose of each parameter.

Pull Consumer

Additionally, you can use PullConsumer::consume. This method handles message buffering, periodically requests the server and monitors timeouts to automatically request the next message batch.

Just like with push consumers, you can call pull directly on the Consumer object:

However, if you want to read messages with multiple consumers within the same process, you need to create a PullConsumer using Consumer::pulling(), and then create multiple consumer instances:

To stop all subscriptions, use Consumer::drain() or Consumer::stop().

You can control the number of requested messages per batch or the batch size using the PullConsumeConfig::maxMessages and PullConsumeConfig::maxBytes parameters respectively. However, only one of these parameters can be set at a time.

Get message

NATS Key Value Store

JetStream, the persistence layer of NATS, not only allows for the higher qualities of service and features associated with 'streaming', but it also enables some functionalities not found in messaging systems like Key Value Store.

Store key values

Watch KV

NATS Object Store

JetStream, the persistence layer of NATS, not only allows for the higher qualities of service and features associated with 'streaming', but it also enables some functionalities not found in messaging systems like Object Store.

Store objects in the buckets

Watch Object Store

NATS CRDT

Distributed Counter CRDT. A Stream can opt in to supporting Counters which will allow any subject to be a counter. All subjects in the stream must be counters. See ADR-49 for details.

Add Counter

Get Counter

Get Counters

NATS Message Scheduler

Delayed Message Scheduling. The AllowMsgSchedules stream configuration option allows the scheduling of messages. Users can use this feature for delayed publishing/scheduling of messages. See ADR-51 for details.

Single scheduled message

NATS JetStream Batch Publishing

The AllowAtomicPublish stream configuration option allows to atomically publish N messages into a stream. See ADR-50 for details.

Publish using PublishBatch

Publish batch using JetStream

Nats Service Api

This is implementation of ADR-32. The core of the Micro component is the Service. A Service aggregates endpoints for handling application logic. Services are named and versioned. You create a Service using the Client::createService(), passing in the Service configuration.

Micro Service

Service endpoints

After a service is created, endpoints can be added. By default, an endpoint is available via its name.

If the subject for the endpoint is more complex (e.g., contains a * or >), the subject can be specified separately from the name.

Groups

Endpoints can also be aggregated using groups. A group represents a common subject prefix used by all endpoints associated with it.

License

The MIT License (MIT). Please see License File for more information.


All versions of nats with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
ext-filter Version *
amphp/amp Version ^3.1.1
amphp/byte-stream Version ^2.1
amphp/parser Version ^1.1
amphp/pipeline Version ^1.2
amphp/socket Version ^2.3.1
cuyz/valinor Version ^1.15 || ^2.3
revolt/event-loop Version ^1.0.8
thesis/package-version Version ^0.1.2
thesis/time-span Version ^0.2.3
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/nats contains the following files

Loading the files please wait ...