I installed yii2-httpclient:
$ composer require --prefer-dist yiisoft/yii2-httpclient
My goal is to display the JSON result of a GET request of an external api in a page.
How to achieve that ?
what to add in web.php , in config / components ?
'Client’ => [ 'class' => 'yii\httpclient\Client' ]
should I create a controller + view ? ( how to ? do you have a sample example ? )
Could you please describe a step by step on how to implement that ?
like this snippet:
use yii\httpclient\Client; $client = new Client(); $response = $client->createRequest() ->setMethod('GET') ->setUrl('the api url') ->send();
in a new page.
Thanks for your support