简体   繁体   中英

php elastica: how to set username / password?

I'm using ruflin/elastica 6.0.1 library, but didn't find a way to set username / password params for connection.

I've tried to set it in host url like this:

https://username:password@host.com

but it did not work.

Is there a way to set username / password in elastica?

This feature has been added by PR#1030 , There are some code usage in test cases, You can create an associate array contains username and password then pass into Elastica\\Client::__construct() .

<?php

use Elastica\Client;

$config = [
    'host' => 'host.com',
    'username' => 'john doe',
    'password' => 's3cret',
];
$client = new Client($config);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM