mggflow / msvc-api
向 laravel 微服务发送请求
v1.0.0
2021-10-30 10:44 UTC
Requires
- guzzlehttp/guzzle: 7.4.x-dev
This package is auto-updated.
Last update: 2024-09-12 21:22:08 UTC
README
关于
此包使得从服务器端代码快速且容易地封装并发送请求到 laravel 微服务 API。
用法
安装方法
composer require mggflow/msvc-api
示例
use MGGFLOW\Microservices\Api;
$msvcName = "msvc_name";
$apiUrl = "https://url.to/api";
// Create instance of API.
$api = new Api($msvcName, $apiUrl);
// Send request to action "hello" of microservice with param "name".
$resp = $api->hello(["name" => "John"])->send();
// Returns json decoded response or false.
var_dump($resp);