Download the PHP package goodway/laravel-nats without Composer

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

Nats jetstream queue for Laravel

License Latest Version Total Downloads

Feel free to contribute or give any feedback.

Prerequisites

Laravel Version

This package can be used in Laravel 8 or higher. The minimum PHP version required is 8.1

Config file

This package publishes a config/nats.php file. If you already have a file by that name, you must rename or remove it, as it will conflict with this package. You could optionally merge your own values with those required by this package, as long as the keys that this package expects are present. See the source file for more details.

Nats Client

As a Nats client we use an external basis-company/nats.php package - the most popular, well-written and functional Nats client for PHP. Greatest thanks to Dmitry Krokhin (nekufa)!

Installation

The recommended way to install the library is through Composer:

You should publish the config/nats.php config file with:

Configuration

Client connection

The client connection configuration is specified in the config/nats.php file. Multiple configuration supported

Queue connection

Describe the queue connection configuration in your 'config/queue.php' file. It supports multiple client configurations.

Example:

Fields description:

You can specify one connection for publisher and another one for consumer, or use one connection for both roles.

You can also use one or separate connections if the publisher client configuration name matches the consumer client configuration. Use this feature through the "queue_separated_clients" bool attribute.

Publishing to queue

The easiest way to send a message to queue is to call a dispatch() method on a simple class that extends NatsMessageJob. The class must contain a body() method that will return the contents of the message. Return type for body() is mixed, it can be either a string or an array. This data will be serialized.

Example:

You can also use a dynamic body by passing content through the constructor.

NatsMessageJob class uses Dispatchable and Queueable concerns and implements classic ShouldQueue interface. Example:

You can also specify the subject for message using the $subject variable (default is "default"), or set it when dispatching a job.

Headers

You can set a message headers using the headers() method of your class. Example:

Listening from queue

You can connect and listen to messages from the queue using standard queue:work mechanism. Example:

Message object structure

Events

These events are fired during the publishing and listening processes.

NatsQueueMessageSent

This event is fired after a message is sent to the queue

NatsQueueMessageReceived

This event is fired when a message is received from the queue


More documentation will be added soon...

...


All versions of laravel-nats with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
basis-company/nats Version ^0.26.2
nesbot/carbon Version ^2.67
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 goodway/laravel-nats contains the following files

Loading the files please wait ....