Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
22 lines (16 sloc) 771 Bytes

Authentication Plugin

This plugin uses the :doc:`authentication component </message/authentication>` from php-http/message to authenticate requests sent through the client:

use Http\Discovery\HttpClientDiscovery;
use Http\Message\Authentication\BasicAuth;
use Http\Client\Common\PluginClient;
use Http\Client\Common\Plugin\AuthenticationPlugin;

$authentication = new BasicAuth('username', 'password');
$authenticationPlugin = new AuthenticationPlugin($authentication);

$pluginClient = new PluginClient(
    HttpClientDiscovery::find(),
    [$authenticationPlugin]
);

Check the :doc:`authentication component documentation </message/authentication>` for the list of available authentication methods.