milyoona/microservice-sdk

Microservice SDK for lumen projects

v2.4.8 2021-10-19 20:23 UTC

README

How to install

composer require milyoona/microservice-sdk
Register the Service Provider in bootstrap/app.php for Lumen:
$app->register(Milyoona\MicroserviceSdk\MicroserviceSdkServiceProvider::class);
Publish configuration files:
php artisan vendor:publish --tag=microservice-sdk
Set prefix in route for Lumen:
// Change the route in app.php
$app->router->group([
    'namespace' => 'App\Http\Controllers',
    'prefix' => 'v1'
], function ($router) {
    require __DIR__.'/../routes/web.php';
});

How to publish migrations

Set configs in config/consumer.php and Run this command

php artisan milyoona:install

php artisan migrate

How to consume messages

php artisan milyoona:consume

Use these directives for amqp configs in .env file

AMQP_HOST=
AMQP_PORT=
AMQP_USER=
AMQP_PASSWORD=

Use these directives for JWT configs in .env file

JWT_SECRET=GKPMVOCKpMCDJQ3GprVA0EfTKGJiTEAImjeKN009Vndls6oRD6raawkRzDoB97AI
JWT_LIFETIME=2

Use these directives for backup database in .env file

DB_HOST_BACKUP=
DB_PORT_BACKUP=
DB_DATABASE_BACKUP=
DB_USERNAME_BACKUP=
DB_PASSWORD_BACKUP=

How to sync database

php artisan milyoona:sync