我以前成功地使用了guzzlehttp/guzzle v.6.*
包認證參數,像這樣:狂飲 - 命令與服務:基本HTTP認證
$client = new GuzzleClient([
'base_uri' => $base_uri ,
'auth' => [ $username, $password ]
]);
這個偉大的工程。但是,我現在試圖使用"guzzlehttp/guzzle-services": "0.5.*"
軟件包來簡化API端點的工作。
使用從GitHub page狂飲服務的下面的例子:
use GuzzleHttp\Client;
use GuzzleHttp\Command\Guzzle\GuzzleClient;
use GuzzleHttp\Command\Guzzle\Description;
$client = new Client();
$description = new Description([
'baseUrl' => 'http://httpbin.org/',
'operations' => [
'testing' => [
'httpMethod' => 'GET',
'uri' => '/get/{foo}',
'responseModel' => 'getResponse',
'parameters' => [
'foo' => [
'type' => 'string',
'location' => 'uri'
],
'bar' => [
'type' => 'string',
'location' => 'query'
]
]
]
],
'models' => [
'getResponse' => [
'type' => 'object',
'additionalProperties' => [
'location' => 'json'
]
]
]
]);
$guzzleClient = new GuzzleClient($client, $description);
$result = $guzzleClient->testing(['foo' => 'bar']);
如何以及在哪裏在世界上使用"guzzlehttp/guzzle-services": "0.5.*"
包當我添加AUTH參數?
我嘗試了一切可能的方式,但無法讓它工作。
我已經嘗試過了,但它並沒有,至少在'guzzlehttp /狂飲.6工作*'包。 – CandyCoated