src/Request.php
public function setAuthentication($username = '', $password = '', $method = CURLAUTH_ANY)
    {
        if (defined('CURLOPT_USERNAME')) {
            $this->curlOptions[ CURLOPT_USERNAME ] = $username;
        }

        $this->curlOptions[ CURLOPT_USERPWD ] = "$username:$password";
        $this->curlOptions[ CURLOPT_HTTPAUTH ] = CURLAUTH_ANY;

        if (in_array($method, [
            CURLAUTH_BASIC,
            CURLAUTH_DIGEST,
            CURLAUTH_GSSNEGOTIATE,
            CURLAUTH_NTLM,
            CURLAUTH_ANY,
            CURLAUTH_ANYSAFE,
        ])) {
            $this->curlOptions[ CURLOPT_HTTPAUTH ] = $method;
        }

        return $this;
    }
public function setAuthentication($username = '', $password = '', $method = CURLAUTH_ANY)
    {
        if (defined('CURLOPT_USERNAME')) {
            $this->curlOptions[ CURLOPT_USERNAME ] = $username;
        }

        $this->curlOptions[ CURLOPT_USERPWD ] = "$username:$password";
        $this->curlOptions[ CURLOPT_HTTPAUTH ] = CURLAUTH_ANY;

        if (in_array($method, [
            CURLAUTH_BASIC,
            CURLAUTH_DIGEST,
            CURLAUTH_GSSNEGOTIATE,
            CURLAUTH_NTLM,
            CURLAUTH_ANY,
            CURLAUTH_ANYSAFE,
        ])) {
            $this->curlOptions[ CURLOPT_HTTPAUTH ] = $method;
        }

        return $this;
    }
Request::setAuthentication

Sets the HTTP authentication method(s) to use.

@param string     $username The HTTP authentication username.
@param string     $password The HTTP authentication password.
@param int|string $method   The HTTP authentication method. The options are:
1. CURLAUTH_BASIC
2. CURLAUTH_DIGEST
3. CURLAUTH_GSSNEGOTIATE
4. CURLAUTH_NTLM
5. CURLAUTH_ANY (default)
6. CURLAUTH_ANYSAFE

@return static