针对 Laravel 5 框架的自定义 PHP Curl 库 - 由小佳亚斯开发

0.3.0 2015-10-28 04:09 UTC

This package is not auto-updated.

Last update: 2024-09-28 18:42:23 UTC


README

为 Laravel 5 定制的 curl 扩展

#安装:将以下内容添加到 composer.json 文件中

{
    "require": {
        "xiaojiays/curl": "~0.3.0"
    }
}

将以下内容添加到 config/app.php 文件中

'providers' => [
    Xiaojiays\Curl\CurlServiceProvider::class,
],

将以下内容添加到 config/app.php 文件中

'facades' => [
    'Curl' => Xiaojiays\Curl\Facades\Curl::class,
],

#使用说明

//send a get request
\Curl::get('http://www.xx.com');

//send a get request in 2 seconds
\Curl::getInSeconds('http://www.xx.com', 2);

//send a get request in 2 milliseconds
\Curl::getInMilliseconds('http://www.xx.com?a=1', 2)

//send a post request
\Curl::post('http://www.xx.com', ['a' => 1, 'b' => 2]);

//send a post request in 2 seconds
\Curl::postInSeconds('http://www.xx.com', ['a' => 1, 'b' => 2], 2);

//send a post request in 2 milliseconds
\Curl::postInMillieconds('http://www.xx.com', ['a' => 1, 'b' => 2], 2);

//download a file
\Curl::download('http://www.xx.com', '1.html');

//send multi get requests
\Curl::multiGet(['http://www.xx.com', 'http://www.mm.com']);

#注意:我还没有测试它!