latvijas-talrunis/api-auth-client-maker
Composer 安装命令:
composer require latvijas-talrunis/api-auth-client-maker
包简介
An API Client Maker For Specific Purpose
README 文档
README
from LT/Utils
How to set up in symfony:
- Install with
composer require latvijas-talrunis/api-auth-client-maker
In the case of your project not being able to find the ClientMaker. This might help:
composer dump-autoload
- Update your project's
services:
LT\Utils\ApiClientMaker\ClientMaker:
arguments:
$authServiceUrl: '%env(string:AUTH_SERVICE_URL)%'
$authServiceUser: '%env(string:AUTH_SERVICE_USER)%'
$authServicePassword: '%env(string:AUTH_SERVICE_PASSWORD)%'
- Update your .env file with these 3 variables
AUTH_SERVICE_URL=http://url.to.the.auth.service
AUTH_SERVICE_USER=root
AUTH_SERVICE_PASSWORD=
- And for the controller:
It needs a class property in which to keep the instantiated ClientMaker
public $clientMaker;
It needs to be set up in the clients constructor
public function __construct(ApiClientMaker $serviceMediatorClientMaker){
$this->clientMaker = $serviceMediatorClientMaker;
}
And then it will be available in every method of this particular controller
#[Route('/test')]
public function index(): Response
{
// authorized symfony http client
$client = $this->clientMaker->getClient();
}
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-02-10