private static function doRequest($url, $headers = [])
    {
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
        curl_setopt($ch, CURLOPT_HEADER, false);
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
        $response = curl_exec($ch);
        if (0 !== $errno = curl_errno($ch)) {
            $errorMessage = curl_strerror($errno);
            Yii::$app->session->setFlash("cURL error ({$errno}):\n {$errorMessage}");
        }
        curl_close($ch);
        return $response;
    }
private static function doRequest($url, $headers = [])
    {
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
        curl_setopt($ch, CURLOPT_HEADER, false);
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
        $response = curl_exec($ch);
        if (0 !== $errno = curl_errno($ch)) {
            $errorMessage = curl_strerror($errno);
            Yii::$app->session->setFlash("cURL error ({$errno}):\n {$errorMessage}");
        }
        curl_close($ch);
        return $response;
    }
private static function doRequest ( $ url , $ headers = [ ] ) { $ ch = curl_init ( $ url ) ; curl_setopt ( $ ch , CURLOPT_CONNECTTIMEOUT , 10 ) ; curl_setopt ( $ ch , CURLOPT_HEADER , false ) ; curl_setopt ( $ ch , CURLOPT_HTTPHEADER , $ headers ) ; curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , true ) ; curl_setopt ( $ ch , CURLOPT_FOLLOWLOCATION , true ) ; $ response = curl_exec ( $ ch ) ; if ( 0 !== $ errno = curl_errno ( $ ch ) ) { $ errorMessage = curl_strerror ( $ errno ) ; Yii :: $ app -> session -> setFlash ( "cURL error ({$errno}):\n {$errorMessage}" ) ; } curl_close ( $ ch ) ; return $ response ; }
Process API requests to github and packagist

@param $url
@param array $headers
@return mixed
Process API requests to github and packagist