src/Auth/ApplicationOnlyAuth.php
public function getBearerToken()
    {
        $url = $this->getBearerTokenUrl();

        $params = array(
            'post' => array('grant_type' => 'client_credentials'),
            'headers' => $this->buildBearerTokenHeader(),
        );

        $response = $this->curl->send($url, $params);

        $obj = json_decode($response['body']);

        if (!$obj || !isset($obj->token_type) || $obj->token_type != 'bearer') {
            $this->findExceptions($response);
        }

        $this->bearerToken = rawurldecode($obj->access_token);

        unset($url, $params, $response, $obj);

        return $this->bearerToken;
    }
public function getBearerToken()
    {
        $url = $this->getBearerTokenUrl();

        $params = array(
            'post' => array('grant_type' => 'client_credentials'),
            'headers' => $this->buildBearerTokenHeader(),
        );

        $response = $this->curl->send($url, $params);

        $obj = json_decode($response['body']);

        if (!$obj || !isset($obj->token_type) || $obj->token_type != 'bearer') {
            $this->findExceptions($response);
        }

        $this->bearerToken = rawurldecode($obj->access_token);

        unset($url, $params, $response, $obj);

        return $this->bearerToken;
    }
Get a bearer token from consumer keys

@return null|string  Bearer token
@throws \TwitterOAuth\Exception\CurlException
@throws \TwitterOAuth\Exception\TwitterException