Download the PHP package butschster/lumen-microservice without Composer
On this page you can find all versions of the php package butschster/lumen-microservice. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download butschster/lumen-microservice
More information about butschster/lumen-microservice
Files in butschster/lumen-microservice
Package lumen-microservice
Short Description This Package will help you to use Lumen framework as a microservice with AMQP and JMS Serializer without extra knowledge.
License MIT
Informations about the package lumen-microservice
Lumen Microservice
This Package can help you to use Lumen framework or Laravel as a microservice without extra knowledge. Just install package, create Exchange Point class and start exchanging information between services through MQ.
This package uses JMS\Serializer for message serialization.
P.S. You can use this service for testing https://www.cloudamqp.com. They have a free plan.
Features
- Easy to use out of the box
- Easy to configure
- jms serializer
- Uses MQ out of the box
- Well tested
Requirements
- Lumen or Laravel 7.x to 8.x
- PHP 7.4 and above
Installation and Configuration
From the command line run
composer require butschster/lumen-microservice
Register Service provider
Copy config files from package config
directory to your Lumen app and register them.
Add variables to your .env file
Create exchange point in your app
This point will use for receiving request from other services and for sending responses.
Then register this point
Register console command
Sending requests
For requesting information from another service you should use ExchangeManager
Broadcasting
If you want to send an event you should use ExchangeManager
method broadcast
Entity mapping
You can configure entity mapping in serializer.php
config.
And then you can easily convert entities to payloads
Custom types
If you want to use custom JMS Serializer types you should use handlers. They can be added in serializer.php
config.
Service running
This single command will run your microservice and start listening to commands registered in your exchange point.
php artisan service:run
Supervisor is a process monitor for the Linux operating system, and will automatically restart your horizon process if it fails. To install Supervisor on Ubuntu, you may use the following command:
sudo apt-get install supervisor
Supervisor configuration files are typically stored in the /etc/supervisor/conf.d directory. Within this directory, you may create any number of configuration files that instruct supervisor how your processes should be monitored. For example, let's create a microservice.conf file that starts and monitors a process:
Once the configuration file has been created, you may update the Supervisor configuration and start the processes using the following commands:
All versions of lumen-microservice with dependencies
ext-json Version *
jms/serializer Version ^3.9
illuminate/config Version ^7.0|^8.0
illuminate/support Version ^7.0|^8.0
illuminate/contracts Version ^7.0|^8.0
illuminate/console Version ^7.0|^8.0
illuminate/validation Version ^7.0|^8.0
illuminate/pipeline Version ^7.0|^8.0
phpdocumentor/reflection-docblock Version ^5.2
php-amqplib/php-amqplib Version ^2.12
psr/log Version ^1.1
react/event-loop Version ^1.1
react/promise Version ^2.8
webmozart/assert Version ^1.8
nunomaduro/collision Version ^5.0
firebase/php-jwt Version ^5.2
zircote/swagger-php Version ^3.0