Skip to content

willove/http

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

🌵 A simple http client wrapper.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%