All Projects → overtrue → Http

overtrue / Http

🌵 A simple http client wrapper.

Projects that are alternatives of or similar to Http

Lua Resty Httpipe
Lua HTTP client cosocket driver for OpenResty / ngx_lua, interfaces are more flexible
Stars: ✭ 71 (-35.45%)
Mutual labels:  http-client
Request Compose
Composable HTTP Client
Stars: ✭ 80 (-27.27%)
Mutual labels:  http-client
Katipo
HTTP2 client for Erlang based on libcurl and libevent
Stars: ✭ 90 (-18.18%)
Mutual labels:  http-client
Rest Client
A tool for automated testing REST API, generating exquisite testing report and REST API documentation.
Stars: ✭ 1,181 (+973.64%)
Mutual labels:  http-client
Bof
The HTTP client for humans
Stars: ✭ 76 (-30.91%)
Mutual labels:  http-client
Piaf
Client library for HTTP/1.X / HTTP/2 written entirely in OCaml.
Stars: ✭ 86 (-21.82%)
Mutual labels:  http-client
Cashew
A simple and elegant yet powerful HTTP client cache for .NET
Stars: ✭ 70 (-36.36%)
Mutual labels:  http-client
Spring Cloud Microservices Development
Spring Cloud Microservices Development.《Spring Cloud 微服务架构开发实战》
Stars: ✭ 106 (-3.64%)
Mutual labels:  http-client
Restclient Cpp
C++ client for making HTTP/REST requests
Stars: ✭ 1,206 (+996.36%)
Mutual labels:  http-client
Got
🌐 Human-friendly and powerful HTTP request library for Node.js
Stars: ✭ 10,620 (+9554.55%)
Mutual labels:  http-client
Fluentlyhttpclient
Http Client for .NET Standard with fluent APIs which are intuitive, easy to use and also highly extensible.
Stars: ✭ 73 (-33.64%)
Mutual labels:  http-client
Request via
RequestVia: A Functional HTTP Client That Wraps Net::HTTP
Stars: ✭ 74 (-32.73%)
Mutual labels:  http-client
Xh
Friendly and fast tool for sending HTTP requests
Stars: ✭ 1,264 (+1049.09%)
Mutual labels:  http-client
Buoy
High-Performance Erlang HTTP 1.1 Client
Stars: ✭ 72 (-34.55%)
Mutual labels:  http-client
Php Fetch
A simple, type-safe, zero dependency port of the javascript fetch WebApi for PHP
Stars: ✭ 95 (-13.64%)
Mutual labels:  http-client
Zio Tls Http
100% non-blocking, Java NIO only( inspired by zio-nio) , JSON HTTP server based on Scala ZIO library. Everything including TLS encryption modeled as ZIO effects, convenient route DSL similar to https4s, up to 30K TPS local JSON transaction with 25 threads on 6 cores(i7) with ZIO fibers.
Stars: ✭ 71 (-35.45%)
Mutual labels:  http-client
Http Client
A high-performance, high-stability, cross-platform HTTP client.
Stars: ✭ 86 (-21.82%)
Mutual labels:  http-client
Snug
Write reusable web API interactions
Stars: ✭ 108 (-1.82%)
Mutual labels:  http-client
Squbs
Akka Streams & Akka HTTP for Large-Scale Production Deployments
Stars: ✭ 1,365 (+1140.91%)
Mutual labels:  http-client
Fetcher Ts
Type-safe wrapper around Fetch API
Stars: ✭ 87 (-20.91%)
Mutual labels:  http-client

Http

🌵 A simple http client wrapper.

Build Status Latest Stable Version Latest Unstable Version Build Status Scrutinizer Code Quality Code Coverage Total Downloads License

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"
//}

Configuration:

use Overtrue\Http\Client;

$config = [
    'base_uri' => 'https://www.easyhttp.com/apiV2/',
    'timeout' => 3000,
    'headers' => [
        'User-Agent' => 'MyClient/1.0',
        'Content-Type' => 'application/json'
    ]
    //...
];

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

//...

Custom response type

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

//...

Logging request and response

Install monolog:

$ composer require monolog/monolog

Add logger middleware:

use Overtrue\Http\Client;

$client = Client::create();

$logger = new \Monolog\Logger('my-logger');

$logger->pushHandler(
    new \Monolog\Handler\RotatingFileHandler('/tmp/my-log.log')
);

$client->pushMiddleware(\GuzzleHttp\Middleware::log(
                            $logger,
                            new \GuzzleHttp\MessageFormatter(\GuzzleHttp\MessageFormatter::DEBUG)
                        ));

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

PHP 扩展包开发

想知道如何从零开始构建 PHP 扩展包?

请关注我的实战课程,我会在此课程中分享一些扩展开发经验 —— 《PHP 扩展包实战教程 - 从入门到发布》

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].