Official HTTP client for Yii 2 released

    The Yii team has released the official HTTP client extension. It was written almost entirely by Pavel Klimov. Until recently, it was not tagged as a release due to incompatibility with the PSR-7, although it has already been used a lot. After much discussion, it was decided to release without PSR-7. They may return to him in 2.1.x.

    Making an HTTP request looks like this:

    use yii\httpclient\Client;
    $client = new Client();
    $response = $client->createRequest()
        ->setData(['name' => 'John Doe', 'email' => ''])
    if ($response->isOk) {
        $newUserId = $response->data['id'];

    Also popular now: