Download the PHP package rabbitevents/publisher without Composer

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

RabbitEvents Publisher

The RabbitEvents Publisher component provides an API for publishing events across the application structure. More information is available in the Nuwber's RabbitEvents documentation.

The RabbitEvents Publisher is the part that informs all other microservices that a payment has succeeded.

Table of Contents

  1. Installation via Composer
  2. Configuration
  3. Publishing
  4. Testing

Installation via Composer

RabbitEvents Publisher can be installed via the Composer package manager:

After installing Publisher, you can execute the rabbitevents:install Artisan command, which will install the RabbitEvents configuration file into your application:

Configuration

Details about the configuration are described in the library documentation.

Publishing

Using an Event class

Here is an example event class:

The only requirement for event classes is to implement the \RabbitEvents\Publisher\ShouldPublish interface.

As an alternative, you could extend \RabbitEvents\Publisher\Support\AbstractPublishableEvent. This class was created to simplify the creation of event classes.

To publish this event, you just need to call the publish method of the event class and pass all the necessary data:

The method publish is provided by the trait Publishable.

Using the publish function

Sometimes, it is easier to use the helper function publish with an event key and payload:

Publish an Event object with the publish function

You can also use a combination of the two previous methods:

Publishing Protobuf Messages

You can publish Google Protobuf messages. The system will automatically handle serialization and set the content_type to application/x-protobuf.

Note: You must install the rabbitevents/protobuf package to use this feature.

The type header will be automatically set to App\Messages\AccountCreated, allowing the consumer to re-hydrate the object.

Testing

We always write tests. Tests in our applications contain many mocks and fakes to test how events are published.

There is the PublishableEventTesting trait that provides assertion methods in an Event class that you want to test.

Event.php

Test.php

If the assertion does not pass, Mockery\Exception\InvalidCountException will be thrown.\ Don't forget to call \Mockery::close() in tearDown or similar methods of your tests.


All versions of publisher with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-json Version *
rabbitevents/foundation Version self.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 rabbitevents/publisher contains the following files

Loading the files please wait ...