我使用ruflin/elastica 6.0.1
库,但没有找到设置用户名/密码参数的方法。
我已尝试将其设置在主机网址中,如下所示:
https://username:password@host.com
但它不起作用。
有没有办法在elastica中设置用户名/密码?
答案 0 :(得分:0)
PR#1030已添加此功能,测试用例中有一些代码用法,您可以创建一个包含username
和password
的关联数组,然后传递到Elastica\Client::__construct()
<?php
use Elastica\Client;
$config = [
'host' => 'host.com',
'username' => 'john doe',
'password' => 's3cret',
];
$client = new Client($config);