承接 solutionplus/microservice 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

solutionplus/microservice

最新稳定版本:1.4.6

Composer 安装命令:

composer require solutionplus/microservice

包简介

a laravel package to deal with specific case of micro-services connection. So, it doesn't suit all needs or handle all connection cases

README 文档

README

solutionplus/microservice is a Laravel package for dealing with specific case of micro-services connection so, it doesn't suit all needs or handle all connection cases.

Table of Content

Installation

Usage

License

Installation

You can install the package using composer

# cli commands

composer require solutionplus/microservice

php artisan ms:install

Important:

Don't forget to modify the added env key MS_GLOBAL_PROJECT_SECRET to exactly match all other microservices projects MS_GLOBAL_PROJECT_SECRET then run:

php artisan config:cache
  • Then apply micro-service on the routes group you will create to communicate with other microservices
Route::group([
    'middleware' => [
        'micro-service',
    ]
], function () {
    // routes communicates with other microservices goes here
});

usage

There is some predefined methods that will help you communicate with other services shown below:

// EX: $microserviceName = 'payment';
// EX: $uri = 'license-payments' || 'orders' ...etc;
// EX: $origin = 'payment.com';

// `$params` and `$data` should be ['key' => 'value'] pair array
// which represent query string in get requests or inputs in post requests

$response = MsHttp::get($microserviceName, $uri, $params = []);

$response = MsHttp::post($microserviceName, $uri, $data = []);

$response = MsHttp::put($microserviceName, $uri, $data = []);

$response = MsHttp::delete($microserviceName, $uri); // Not finished yet

$response = MsHttp::establish($microserviceName, $origin, $localPort);

The above methods are must to be used if you need to encrypt requests between micro-services

Note:

in case the middlewares are not auto discovered then follow the next steps:

  • add both middlewares micro-service and micro-service-establish-connection to $routeMiddleware array inside kernel.php file like so:
# In kernel.php file


/**
 * The application's route middleware.
 *
 * These middleware may be assigned to groups or used individually.
 *
 * @var array<string, class-string|string>
 */
protected $routeMiddleware = [
    //
    'micro-service' => \Solutionplus\MicroService\Http\Middleware\MicroServiceMiddleware::class,
    'micro-service-establish-connection' => \Solutionplus\MicroService\Http\Middleware\MicroServiceEstablishConnectionMiddleware::class,
];

Using micro-service middleware on micro-services routes group is a must as it's responsible about decoding requests in order to make you deal with it as you usually do. Otherwise it will lead to unexpected results.

Note:

Don't use micro-service-establish-connection on any request yourself. It's already running on the predefinedmicro-services store route.

Note:

UNDER CONSTRUCTION.

License

Solutionplus/MicroService package is limited and proprietary software belongs to Solutionplus.net company.

统计信息

  • 总下载量: 544
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2023-02-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固