Skip to content

Create Rest Request (POST,GET,PUT,DELETE,...)

Notifications You must be signed in to change notification settings

mehrud/Yii2-Curl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

Yii2 Curl

Create Rest Request (POST,GET,PUT,DELETE,...)

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require amirasaran/yii2-curl:dev-master

or add

"amirasaran/yii2-curl": "dev-master"

to the require section of your composer.json file.

Configure

Add the following code to your common/config/main.php components

'components' => [
    ...
    'curl' => [
        'class' => 'amirasaran\yii2curl\Curl',
        'connectionTimeout' => 100,
        'dataTimeout' => 100,
    ],
    ...
]

Usage

        $url = 'http://jsonplaceholder.typicode.com/posts';
        /** @var \amirasaran\yii2curl\Curl $curl */
        $curl = Yii::$app->curl;
        $res = $curl->get($url,[],false);
        echo '<pre>';
        print_r($res);exit;

About

Create Rest Request (POST,GET,PUT,DELETE,...)

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%