amirasaran / yii2-curl
Create Rest Request (POST,GET,PUT,DELETE,...)
Installs: 4 666
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 3
Forks: 1
Open Issues: 0
Requires
- yiisoft/yii2: *
This package is auto-updated.
Last update: 2024-12-09 19:18:26 UTC
README
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;