🌵 A simple http client wrapper.
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
tests
.editorconfig
.gitattributes
.gitignore
.php_cs
README.md
composer.json
phpunit.xml.dist

README.md

Http

🌵 A simple http client wrapper.

Installing

$ composer require overtrue/http -vvv

Usage

<?php

use Overtrue\Http\Client;

$client = Client::create(); 

$response = $client->get('https://httpbin.org/ip');
//{
//    "ip": "1.2.3.4"
//}

Using configuration:


use Overtrue\Http\Client;
use Overtrue\Http\Config;

$config = new Config([
    'base_uri' => 'https://www.easywechat.com/apiV2/',
    'timeout' => 3000,
    //'connect_timeout' => 3000,
]);

$client = Client::create($config); // or new Client($config);

//...

Custom response type:

$config = new Config([
    'base_uri' => 'https://www.easywechat.com/apiV2/',
    
    // array(default)/collection/object/raw
    'response_type' => 'collection', 
]);

//...

License

MIT