1. Go to this page and download the library: Download buqiu/microservices-request library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
buqiu / microservices-request example snippets
use Buqiu\MicroservicesRequest\MicroservicesHttpService;
public function __construct(MicroservicesHttpService $microservicesHttpService)
{
$this->microservicesHttpService = $microservicesHttpService;
}
public function index()
{
$user = $this->microservicesHttpService->setEndpoint('user')->get('user');
}
use Buqiu\MicroservicesRequest\MicroservicesHttpService;
public function index()
{
$user = app(MicroservicesHttpService::class)->setEndpoint('user')->get('user');
}
// 或
public function index()
{
$user = app(MicroservicesHttpService::class, ['serviceName' => 'user'])->get('user');
}