Download the PHP package everlution/message-bus without Composer

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

Everlution PHP MessageBus

This library provides an eventbus solution in PHP for making microservices interact together.

Installation

As usual just use composer as follows

Components

This library provides default components but you can easily develop your owns by implementing the proper interfaces.

Transport

Must implement Everlution\MessageBus\Transport\TransportInterface.

This component is the actual service that interacts with the "physical" message bus. In other words it is the implementation for using a specific technology.

This library provides already a transport for RabbitMQ Everlution\MessageBus\Transport\RabbitMqTransport using a fanout exchange and re-publishing the message in case of any exception thrown within your consumer.

Message Definition

This is the actual message that will be published on the Transport.

A message can only be an array that will be validated using a JSON Schema definition. In fact the message definition requires you to provide:

The library provides the Everlution\MessageBus\MessageDefinition\PingMessageDefinition for testing purposes.

So in order to define what consumers can publish on the message bus you need to create your messages definitions and then add them to the Protocol.

You can literally shape the message definition as you want as this library doesn't force you to follow any constraint.

Protocol

The Protocol defines in fact the protocol used by all the consumers of the message bus for describing the structure of all the available messages that can be published on the Transport.

A Protocol must implement the $protocol->addMessageDefinition() method that you need to call for every message definition you want to use within your environment.

It basically represents not only a registry of message definitions.

This library provides a default Protocol Everlution\MessageBus\Protocol\DefaultProtocol which basically allows publishers to publish only one of the messages that match one of the message definitions added to the Protocol.

Validator

This component is in charge of validating a message against the Protocol.

The Everlution\MessageBus\Validator\DefaultValidator provided uses the Opis\JsonSchema library for that but you can develop your own validation service by implementing Everlution\MessageBus\Validator\ValidatorInterface.

Serializer

The Serializer clearly transforms the message array you want to publish on the Transport into a string and viceversa.

The library provides already the Everlution\MessageBus\Serializer\JsonSerializer.

Publisher

The Publisher must implement Everlution\MessageBus\Publisher\PublisherInterface and its task is to publish the message on the Transport.

The Everlution\MessageBus\Publisher\DefaultPublisher provided does the following steps:

  1. validates the message against the Protocol
  2. serializes the message
  3. publishes the message on the Transport

Consumer

The Consumer must implement Everlution\MessageBus\Consumer\ConsumerInterface and defines the business logic within your application of how you want to consume messages.

This library provides two consumers.

Echo Consumer

This consumer Everlution\MessageBus\Consumer\EchoConsumer is just for testing purposes and basically does a var_dump(message).

Symfony Event Dispatcher Consumer

This consumer Everlution\MessageBus\Consumer\SymfonyEventDispatcherConsumer integrates with Symfony and allows you to transform a normal message into a Symfony Event and dispatch it within your application. In this way you can simply define an event subscriber to that and implement all the logic you need.

This concept decouples the message bus from you application as event subscribers don't who generated the event.

Simulator

It is very likely that if you are using this library you are working with microservices. If this is so you probably don't want to have all the microservices up and running in your local environment in order to generate messages on the bus. On top of that it would be even hard to generate the messages that you need.

The Simulator helps you out as you only need to run locally your microservice and use the Simulator to generate only the messages that you need as if they would come from other sources.

This concept is really useful as it saves you so much time and allows you to concentrate only on that microservice.

This library provides Everlution\MessageBus\Simulator\JsonSchemaFakerSimulator that uses the JSON Schema of the message that you want to simulate and using the Faker library it generates and publish a valid message. This service doesn't cover up all the JSON Schemas you may define but it's a good starting point.

You can extend it or implement your own Simulator by implementing Everlution\MessageBus\Simulator\SimulatorInterface.

Demo

You can find some working examples in /demo.

You can run them using docker with the following commands:


All versions of message-bus with dependencies

PHP Build Version
Package Version
Requires php Version >=7
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 everlution/message-bus contains the following files

Loading the files please wait ....