Unirest in PHP: Simplified, lightweight HTTP client library.

Related tags

HTTP unirest-php
Overview

Unirest for PHP Build Status version

Downloads Code Climate Coverage Status Dependencies Gitter License

Unirest is a set of lightweight HTTP libraries available in multiple languages, built and maintained by Mashape, who also maintain the open-source API Gateway Kong.

Features

  • Utility methods to call GET, HEAD, POST, PUT, DELETE, CONNECT, OPTIONS, TRACE, PATCH requests
  • Supports form parameters, file uploads and custom body entities
  • Supports gzip
  • Supports Basic, Digest, Negotiate, NTLM Authentication natively
  • Customizable timeout
  • Customizable default headers for every request (DRY)
  • Automatic JSON parsing into a native object for JSON responses

Requirements

Installation

Using Composer

To install unirest-php with Composer, just add the following to your composer.json file:

{
    "require-dev": {
        "mashape/unirest-php": "3.*"
    }
}

or by running the following command:

composer require mashape/unirest-php

This will get you the latest version of the reporter and install it. If you do want the master, untagged, version you may use the command below:

composer require mashape/php-test-reporter dev-master

Composer installs autoloader at ./vendor/autoloader.php. to include the library in your script, add:

require_once 'vendor/autoload.php';

If you use Symfony2, autoloader has to be detected automatically.

You can see this library on Packagist.

Install from source

Download the PHP library from Github, then include Unirest.php in your script:

git clone [email protected]:Mashape/unirest-php.git 
require_once '/path/to/unirest-php/src/Unirest.php';

Usage

Creating a Request

So you're probably wondering how using Unirest makes creating requests in PHP easier, let's look at a working example:

$headers = array('Accept' => 'application/json');
$query = array('foo' => 'hello', 'bar' => 'world');

$response = Unirest\Request::post('http://mockbin.com/request', $headers, $query);

$response->code;        // HTTP Status code
$response->headers;     // Headers
$response->body;        // Parsed body
$response->raw_body;    // Unparsed body

JSON Requests (application/json)

A JSON Request can be constructed using the Unirest\Request\Body::Json helper:

$headers = array('Accept' => 'application/json');
$data = array('name' => 'ahmad', 'company' => 'mashape');

$body = Unirest\Request\Body::json($data);

$response = Unirest\Request::post('http://mockbin.com/request', $headers, $body);

Notes:

  • Content-Type headers will be automatically set to application/json
  • the data variable will be processed through json_encode with default values for arguments.
  • an error will be thrown if the JSON Extension is not available.

Form Requests (application/x-www-form-urlencoded)

A typical Form Request can be constructed using the Unirest\Request\Body::Form helper:

$headers = array('Accept' => 'application/json');
$data = array('name' => 'ahmad', 'company' => 'mashape');

$body = Unirest\Request\Body::form($data);

$response = Unirest\Request::post('http://mockbin.com/request', $headers, $body);

Notes:

  • Content-Type headers will be automatically set to application/x-www-form-urlencoded
  • the final data array will be processed through http_build_query with default values for arguments.

Multipart Requests (multipart/form-data)

A Multipart Request can be constructed using the Unirest\Request\Body::Multipart helper:

$headers = array('Accept' => 'application/json');
$data = array('name' => 'ahmad', 'company' => 'mashape');

$body = Unirest\Request\Body::multipart($data);

$response = Unirest\Request::post('http://mockbin.com/request', $headers, $body);

Notes:

  • Content-Type headers will be automatically set to multipart/form-data.
  • an auto-generated --boundary will be set.

Multipart File Upload

simply add an array of files as the second argument to to the Multipart helper:

$headers = array('Accept' => 'application/json');
$data = array('name' => 'ahmad', 'company' => 'mashape');
$files = array('bio' => '/path/to/bio.txt', 'avatar' => '/path/to/avatar.jpg');

$body = Unirest\Request\Body::multipart($data, $files);

$response = Unirest\Request::post('http://mockbin.com/request', $headers, $body);

If you wish to further customize the properties of files uploaded you can do so with the Unirest\Request\Body::File helper:

$headers = array('Accept' => 'application/json');
$body = array(
    'name' => 'ahmad', 
    'company' => 'mashape'
    'bio' => Unirest\Request\Body::file('/path/to/bio.txt', 'text/plain'),
    'avatar' => Unirest\Request\Body::file('/path/to/my_avatar.jpg', 'text/plain', 'avatar.jpg')
);

$response = Unirest\Request::post('http://mockbin.com/request', $headers, $body);

Note: we did not use the Unirest\Request\Body::multipart helper in this example, it is not needed when manually adding files.

Custom Body

Sending a custom body such rather than using the Unirest\Request\Body helpers is also possible, for example, using a serialize body string with a custom Content-Type:

$headers = array('Accept' => 'application/json', 'Content-Type' => 'application/x-php-serialized');
$body = serialize((array('foo' => 'hello', 'bar' => 'world'));

$response = Unirest\Request::post('http://mockbin.com/request', $headers, $body);

Authentication

First, if you are using Mashape:

// Mashape auth
Unirest\Request::setMashapeKey('<mashape_key>');

Otherwise, passing a username, password (optional), defaults to Basic Authentication:

// basic auth
Unirest\Request::auth('username', 'password');

The third parameter, which is a bitmask, will Unirest which HTTP authentication method(s) you want it to use for your proxy authentication.

If more than one bit is set, Unirest (at PHP's libcurl level) will first query the site to see what authentication methods it supports and then pick the best one you allow it to use. For some methods, this will induce an extra network round-trip.

Supported Methods

Method Description
CURLAUTH_BASIC HTTP Basic authentication. This is the default choice
CURLAUTH_DIGEST HTTP Digest authentication. as defined in RFC 2617
CURLAUTH_DIGEST_IE HTTP Digest authentication with an IE flavor. The IE flavor is simply that libcurl will use a special "quirk" that IE is known to have used before version 7 and that some servers require the client to use.
CURLAUTH_NEGOTIATE HTTP Negotiate (SPNEGO) authentication. as defined in RFC 4559
CURLAUTH_NTLM HTTP NTLM authentication. A proprietary protocol invented and used by Microsoft.
CURLAUTH_NTLM_WB NTLM delegating to winbind helper. Authentication is performed by a separate binary application. see libcurl docs for more info
CURLAUTH_ANY This is a convenience macro that sets all bits and thus makes libcurl pick any it finds suitable. libcurl will automatically select the one it finds most secure.
CURLAUTH_ANYSAFE This is a convenience macro that sets all bits except Basic and thus makes libcurl pick any it finds suitable. libcurl will automatically select the one it finds most secure.
CURLAUTH_ONLY This is a meta symbol. OR this value together with a single specific auth value to force libcurl to probe for un-restricted auth and if not, only that single auth algorithm is acceptable.
// custom auth method
Unirest\Request::proxyAuth('username', 'password', CURLAUTH_DIGEST);

Previous versions of Unirest support Basic Authentication by providing the username and password arguments:

$response = Unirest\Request::get('http://mockbin.com/request', null, null, 'username', 'password');

This has been deprecated, and will be completely removed in v.3.0.0 please use the Unirest\Request::auth() method instead

Cookies

Set a cookie string to specify the contents of a cookie header. Multiple cookies are separated with a semicolon followed by a space (e.g., "fruit=apple; colour=red")

Unirest\Request::cookie($cookie)

Set a cookie file path for enabling cookie reading and storing cookies across multiple sequence of requests.

Unirest\Request::cookieFile($cookieFile)

$cookieFile must be a correct path with write permission.

Request Object

Unirest\Request::get($url, $headers = array(), $parameters = null)
Unirest\Request::post($url, $headers = array(), $body = null)
Unirest\Request::put($url, $headers = array(), $body = null)
Unirest\Request::patch($url, $headers = array(), $body = null)
Unirest\Request::delete($url, $headers = array(), $body = null)
  • url - Endpoint, address, or uri to be acted upon and requested information from.
  • headers - Request Headers as associative array or object
  • body - Request Body as associative array or object

You can send a request with any standard or custom HTTP Method:

Unirest\Request::send(Unirest\Method::LINK, $url, $headers = array(), $body);

Unirest\Request::send('CHECKOUT', $url, $headers = array(), $body);

Response Object

Upon recieving a response Unirest returns the result in the form of an Object, this object should always have the same keys for each language regarding to the response details.

  • code - HTTP Response Status Code (Example 200)
  • headers - HTTP Response Headers
  • body - Parsed response body where applicable, for example JSON responses are parsed to Objects / Associative Arrays.
  • raw_body - Un-parsed response body

Advanced Configuration

You can set some advanced configuration to tune Unirest-PHP:

Custom JSON Decode Flags

Unirest uses PHP's JSON Extension for automatically decoding JSON responses. sometime you may want to return associative arrays, limit the depth of recursion, or use any of the customization flags.

To do so, simply set the desired options using the jsonOpts request method:

Unirest\Request::jsonOpts(true, 512, JSON_NUMERIC_CHECK & JSON_FORCE_OBJECT & JSON_UNESCAPED_SLASHES);

Timeout

You can set a custom timeout value (in seconds):

Unirest\Request::timeout(5); // 5s timeout

Proxy

Set the proxy to use for the upcoming request.

you can also set the proxy type to be one of CURLPROXY_HTTP, CURLPROXY_HTTP_1_0, CURLPROXY_SOCKS4, CURLPROXY_SOCKS5, CURLPROXY_SOCKS4A, and CURLPROXY_SOCKS5_HOSTNAME.

check the cURL docs for more info.

// quick setup with default port: 1080
Unirest\Request::proxy('10.10.10.1');

// custom port and proxy type
Unirest\Request::proxy('10.10.10.1', 8080, CURLPROXY_HTTP);

// enable tunneling
Unirest\Request::proxy('10.10.10.1', 8080, CURLPROXY_HTTP, true);
Proxy Authenticaton

Passing a username, password (optional), defaults to Basic Authentication:

// basic auth
Unirest\Request::proxyAuth('username', 'password');

The third parameter, which is a bitmask, will Unirest which HTTP authentication method(s) you want it to use for your proxy authentication.

If more than one bit is set, Unirest (at PHP's libcurl level) will first query the site to see what authentication methods it supports and then pick the best one you allow it to use. For some methods, this will induce an extra network round-trip.

See Authentication for more details on methods supported.

// basic auth
Unirest\Request::proxyAuth('username', 'password', CURLAUTH_DIGEST);

Default Request Headers

You can set default headers that will be sent on every request:

Unirest\Request::defaultHeader('Header1', 'Value1');
Unirest\Request::defaultHeader('Header2', 'Value2');

You can set default headers in bulk by passing an array:

Unirest\Request::defaultHeaders(array(
    'Header1' => 'Value1',
    'Header2' => 'Value2'
));

You can clear the default headers anytime with:

Unirest\Request::clearDefaultHeaders();

Default cURL Options

You can set default cURL options that will be sent on every request:

Unirest\Request::curlOpt(CURLOPT_COOKIE, 'foo=bar');

You can set options bulk by passing an array:

Unirest\Request::curlOpts(array(
    CURLOPT_COOKIE => 'foo=bar'
));

You can clear the default options anytime with:

Unirest\Request::clearCurlOpts();

SSL validation

You can explicitly enable or disable SSL certificate validation when consuming an SSL protected endpoint:

Unirest\Request::verifyPeer(false); // Disables SSL cert validation

By default is true.

Utility Methods

// alias for `curl_getinfo`
Unirest\Request::getInfo()

// returns internal cURL handle
Unirest\Request::getCurlHandle()

Made with from the Mashape team

Comments
  • Asynchronous requests

    Asynchronous requests

    I would really like to add asynchronous request support to Unirest-PHP, so that it can match the feature set of the other Unirest libraries (http://unirest.io).

    PHP doesn't natively support threads, and it doesn't seem to be a standard practice for achieving this. I would like to encourage a discussion to share some ideas for a possible async implementation.

    opened by subnetmarco 11
  • Json decoding responses into associative arrays

    Json decoding responses into associative arrays

    Right now there doesn't seem to be an option to decode json responses as arrays all the time. There should be an option for putting settings on the JSON decode.

    opened by CMCDragonkai 7
  • Error: Parse error: syntax error, unexpected T_STRING

    Error: Parse error: syntax error, unexpected T_STRING

    I am getting the following error:

    Parse error: syntax error, unexpected T_STRING in /path/to/unirest-php/src/Unirest/Exception.php on line 3
    

    I swapped out my real path for /path/to/.

    PHP Version 5.4.45
    

    Thanks.

    opened by n01ukn0w 6
  • Raw php Data with delete/put request

    Raw php Data with delete/put request

    Hi,

    When i call the http delete request with multiple parameters, i'm receiving the request on the other end as raw POST:

    ------------------------------4a8b2889f9f5 Content-Disposition: form-data; name="amount"

    0.25

    This does not happen when calling the post method.

    I have tried updating the headers to be:

    $headers = array( "Accept" => "application/json", "Content-type" => "application/x-www-form-urlencoded" );

    But the issue still happens.

    Any thought on the issue?

    opened by dchankhour2 6
  • SSL verifier fix

    SSL verifier fix

    I have added the method to specify the certificate file. ie (PEM). I have added a working example to the test folder along with the certificate. You can verify it and also you can download the ssl certifcate from firefox for any website that offers ssl and when saving save it as .pem file instead of .crt and choose the option to download with chain.

    opened by yousafsyed 6
  • SSL certificate problem

    SSL certificate problem

    Hi there, trying to use this with the Mashape API, and get this lovely exception when trying to make a request to an API endpoint:

    Fatal error: Uncaught exception 'Exception' with message 'SSL certificate problem: self signed certificate in certificate chain' in C:_\unirest\lib\Unirest\Unirest.php:166 Stack trace: #0 C:*_\unirest\lib\Unirest\Unirest.php(47): Unirest::request('GET', 'https://yoda.p....', NULL, Array, NULL, NULL) #1 C:*\yoda.php(9): Unirest::get('https://yoda.p....', Array, NULL) #2 {main} thrown in C:**\unirest\lib\Unirest\Unirest.php on line 166

    opened by mattarnster 6
  • Parse error: syntax error, unexpected T_STRING

    Parse error: syntax error, unexpected T_STRING

    I am trying to use Unirest in my project, but it returns this error all the time:

    Parse error: syntax error, unexpected T_STRING in /home/a3698007/public_html/lib/Unirest/HttpMethod.php on line 1

    Why is this happening?

    I am just doing this, like it suggests in the documentation:

    require_once './lib/Unirest.php';

    opened by CleverBeast 6
  • 400 Bad request issue

    400 Bad request issue

    My code:

    $response = Unirest\Request::post("https://textanalysis.p.mashape.com/nltk-sentence-segmentation",
      array(
        "X-Mashape-Key" => <key>,
        "Content-Type" => "application/x-www-form-urlencoded",
        "Accept" => "application/json"
      ),
      array(
        "text" => "Natural language processing (NLP) deals with the application of computational models to text or speech data. Application areas within NLP include automatic (mach
      )
    );
    

    Response:

    Unirest\Response Object
    (
        [code] => 400
        [raw_body] => <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
    <title>400 Bad Request</title>
    <h1>Bad Request</h1>
    <p>The browser (or proxy) sent a request that this server could not understand.</p>
    
        [body] => <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
    <title>400 Bad Request</title>
    <h1>Bad Request</h1>
    <p>The browser (or proxy) sent a request that this server could not understand.</p>
    
        [headers] => Array
            (
                [0] => HTTP/1.1 400 BAD REQUEST
                [Content-Type] => text/html
                [Date] => Wed, 24 Feb 2016 15:33:40 GMT
                [Server] => Mashape/5.0.6
                [X-RateLimit-requests-Limit] => 1000
                [X-RateLimit-requests-Remaining] => 974
                [Content-Length] => 192
                [Connection] => keep-alive
            )
    )
    

    cURL works fine: curl -X POST --include 'https://textanalysis.p.mashape.com/spacy-named-entity-recognition-ner'
    -H 'X-Mashape-Key: '
    -H 'Content-Type: application/x-www-form-urlencoded'
    -H 'Accept: application/json'
    -d 'text=Rami Eid is studying at Stony Brook University in New York'

    I thought it might be a SSL problem, so I disabled peer verification with:

    Unirest\Request::verifyPeer(false);
    

    Is there a way to see all the curl options from unirest? Or debug the request somehow?

    opened by nittonfemton 5
  • 403

    403

    Always get 403 error, its works with CURL but Unirest is not working i try from CLI and from WebServer

    here is the code: $response = Unirest\Request::post("https://community-neutrino-ip-info.p.mashape.com/ip-info", array( "X-Mashape-Key" => "XXXX", "Content-Type" => "application/x-www-form-urlencoded", "Accept" => "application/json" ), array( "ip" => "5.29.224.80", "reverse-lookup" => true ) );

    opened by garrylachman 5
  • curl_setopt_array()

    curl_setopt_array()

    curl_setopt_array(): CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set...

    [ROOT/vendors/unirest/src/Unirest/Request.php, line 423]

    opened by flylogs 5
  • Fix querystrings getting urlencoded twice.

    Fix querystrings getting urlencoded twice.

    Because http_build_query() urlencodes the result, but it is also urlencoded once again in Unirest::encodeUrl() when http_build_query() is called again in there

    opened by ekhaled 5
  • issue 156, avoid PHP 7.4 Notice (array offset on value of type int)

    issue 156, avoid PHP 7.4 Notice (array offset on value of type int)

    This should fix issue #156 - $port is an integer, and there is no reason to access it as an array or string.

    I noticed there is no test for this, and don't know how to create one. Also, the UnirestRequestTest::testGzip test seems to be failing, but it already did that before my change.

    opened by ennorehling 1
  • How to get in touch regarding a security concern

    How to get in touch regarding a security concern

    Hey there!

    I belong to an open source security research community, and a member (@ranjit-git) has found an issue, but doesn’t know the best way to disclose it.

    If not a hassle, might you kindly add a SECURITY.md file with an email, or another contact method? GitHub recommends this best practice to ensure security issues are responsibly disclosed, and it would serve as a simple instruction for security researchers in the future.

    Thank you for your consideration, and I look forward to hearing from you!

    (cc @huntr-helper)

    opened by JamieSlome 0
  • Request::encodeUrl breaks with PHP 7.4 and ports in host name

    Request::encodeUrl breaks with PHP 7.4 and ports in host name

    encodeUrl breaks in

        if ($port && $port[0] !== ':') {
            $port = ':' . $port;
        }
    

    with "Notice: Trying to access array offset on value of type int".

    Modifying the if query to honor the variable type seems to help.

    if ($port && ((gettype($port) == "string" && $port[0] !== ':') || gettype($port) == "integer")) { $port = ':' . $port; }

    I don't have cloned the project and I am currently very short in time, can someone please fix this issue and make an update available to composer?

    Kind regards and have a nice Xmas.

    Reproduce:

    `<?php $url_parsed = array ( 'scheme' => 'http', 'host' => 'localhost', 'port' => 10003, 'path' => '/some/path', );

    $port = (isset($url_parsed['port']) ? $url_parsed['port'] : null);

    // breaks if ($port && $port[0] !== ':') { $port = ':' . $port; }

    // seems to work if ($port && ((gettype($port) == "string" && $port[0] !== ':') || gettype($port) == "integer")) { $port = ':' . $port; }

    var_export($port); `

    opened by EdgarWahn 3
  • parse_url does not return port as array, but it is used as array in R…

    parse_url does not return port as array, but it is used as array in R…

    …equest.php

    So I added a check, wether this is an array actually, else I use the port as intended as int. I would assume, that that array check is needless altogether but maybe old PHP versions needed that?

    opened by brockhaus 1
Releases(v3.0.4)
  • v3.0.4(Aug 11, 2016)

  • v3.0.3(May 31, 2016)

  • v3.0.2(Apr 29, 2016)

  • v3.0.1(Mar 23, 2016)

  • v3.0.0(Feb 25, 2016)

    Changed:
    Added:
    • Unirest\Request\Body::Form for constructing application/x-www-form-urlencoded request bodies
    • Unirest\Request\Body::Json for constructing application/json request bodies
    • Unirest\Request\Body::Multipart($dat, $files) for constructing multipart/form-data request bodies and file uploads
    • Unirest\Request\Body::File for single file upload parameter construction
    Removed:
    • Unirest\File
    Fixes:
    • #93
    • #87
    • #92

    Please Review the README for the updated API.

    Source code(tar.gz)
    Source code(zip)
  • v2.6.6(Feb 16, 2016)

  • v2.6.5(Jan 20, 2016)

  • v2.6.4(Dec 15, 2015)

  • v2.6.3(Dec 11, 2015)

  • v2.6.2(Jul 27, 2015)

  • 2.6.1(Jun 8, 2015)

  • v2.6.0(Apr 8, 2015)

  • v2.5.0(Apr 3, 2015)

  • v2.4.0(Apr 2, 2015)

  • v2.3.1(Mar 7, 2015)

  • v2.3.0(Mar 1, 2015)

    New Utility Methods

    • Allow direct access to internal cURL handle with Unirest\Request::getCurlHandle()
    • expose cURL info with Unirest\Request::getInfo() for debugging failed requests
    Source code(tar.gz)
    Source code(zip)
  • v2.2.1(Feb 5, 2015)

  • v2.2.0(Feb 5, 2015)

    Advanced Authentication Methods

    Unirest\Request::auth($username, $password = '', $method = CURLAUTH_BASIC);
    

    Supports Basic, Digest, Negotiate, NTLM Authentication natively, see README for more details.

    Proxy Support

    Unirest\Request::proxy($address, $port = 1080, $type = CURLPROXY_HTTP, $tunnel = false);
    
    • proxy port defaults to 1080 as per cURL defaults

    • check the cURL docs for more info on tunneling.

    • proxy type to be one of CURLPROXY_HTTP, CURLPROXY_HTTP_1_0, CURLPROXY_SOCKS4, CURLPROXY_SOCKS5, CURLPROXY_SOCKS4A, and CURLPROXY_SOCKS5_HOSTNAME.

      check the cURL docs for more info.

    full usage example:

    // quick setup with default port: 1080
    Unirest\Request::proxy('10.10.10.1');
    
    // custom port and proxy type
    Unirest\Request::proxy('10.10.10.1', 8080, CURLPROXY_HTTP);
    
    // enable tunneling
    Unirest\Request::proxy('10.10.10.1', 8080, CURLPROXY_HTTP, true);
    

    Proxy Authentication

    Unirest\Request::proxyAuth($username, $password = '', $method = CURLAUTH_BASIC);
    

    Supports Basic, Digest, Negotiate, NTLM Authentication natively, see README for more details.

    Source code(tar.gz)
    Source code(zip)
  • 2.1.0(Jan 15, 2015)

    • send requests using any standard or custom HTTP Method using Unirest\Request::send
    • set custom JSON Decode Flags using the Unirest\Request::jsonOpts() method.
    • You can now set default headers in bulk using Unirest\Request::defaultHeaders()
    Source code(tar.gz)
    Source code(zip)
  • 2.0.0(Jan 15, 2015)

    Cleanups & Updates

    • added EditorConfig file
    • added Code Coverage through Code Climate
    • added support for PHP 5.6 in Travis
    • added Hack Lang Environment to Travis
    • updated testing to use phpunit
    • various coding style, and comprehensibility fixes in accordance with PSR-1 & PSR-2
    • added enhanced response header parser
    • removed redundant code where applicable
    • updated Unirest\File::add signature to follow after curl_file_create with fallback

    Breaking Changes

    • removed PHP 5.3 reached EOL on 14 Aug 2014
    • relocated files to src and tests as per phpunit standard tree structure
    • renamed classes with logical name spacing to Unirest\Request, Unirest\Response, Unirest\Method, Unirest\File
    Source code(tar.gz)
    Source code(zip)
Owner
Kong
The Cloud Connectivity Company. Community Driven & Enterprise Adopted.
Kong
Unirest is a set of lightweight HTTP libraries available in multiple languages.

Unirest for PHP Unirest is a set of lightweight HTTP libraries available in multiple languages. This fork is maintained by APIMatic for its Code Gener

APIMatic 14 Oct 26, 2022
PHP's lightweight HTTP client

Buzz - Scripted HTTP browser Buzz is a lightweight (<1000 lines of code) PHP 7.1 library for issuing HTTP requests. The library includes three clients

Kris Wallsmith 1.9k Jan 4, 2023
Declarative HTTP Clients using Guzzle HTTP Library and PHP 8 Attributes

Waffler How to install? $ composer require waffler/waffler This package requires PHP 8 or above. How to test? $ composer phpunit Quick start For our e

Waffler 3 Aug 26, 2022
Guzzle, an extensible PHP HTTP client

Guzzle, PHP HTTP client Guzzle is a PHP HTTP client that makes it easy to send HTTP requests and trivial to integrate with web services. Simple interf

Guzzle 22.3k Jan 2, 2023
A Chainable, REST Friendly, PHP HTTP Client. A sane alternative to cURL.

Httpful Httpful is a simple Http Client library for PHP 7.2+. There is an emphasis of readability, simplicity, and flexibility – basically provide the

Nate Good 1.7k Dec 21, 2022
HTTPlug, the HTTP client abstraction for PHP

HTTPlug HTTPlug, the HTTP client abstraction for PHP. Intro HTTP client standard built on PSR-7 HTTP messages. The HTTPlug client interface is compati

The PHP HTTP group 2.4k Dec 30, 2022
↪️ Bypass for PHP creates a custom HTTP Server to return predefined responses to client requests

Bypass for PHP provides a quick way to create a custom HTTP Server to return predefined responses to client requests.Useful for tests with Pest PHP or PHPUnit.

CiaReis 101 Dec 1, 2022
A PHP proxy to solve client browser HTTP CORS(cross-origin) restrictions.

cors-bypass-proxy A PHP proxy to solve client browser HTTP CORS(cross-origin) restrictions. A simple way to solve CORS issue when you have no access t

Gracious Emmanuel 15 Nov 17, 2022
Zenscrape package is a simple PHP HTTP client-provider that makes it easy to parsing site-pages

Zenscrape package is a simple PHP HTTP client-provider that makes it easy to parsing site-pages

Andrei 3 Jan 17, 2022
Async HTTP/1.1+2 client for PHP based on Amp.

This package provides an asynchronous HTTP client for PHP based on Amp. Its API simplifies standards-compliant HTTP resource traversal and RESTful web

AMPHP 641 Dec 19, 2022
Simple HTTP cURL client for PHP 7.1+ based on PSR-18

Simple HTTP cURL client for PHP 7.1+ based on PSR-18 Installation composer require sunrise/http-client-curl QuickStart composer require sunrise/http-f

Sunrise // PHP 15 Sep 5, 2022
Event-driven, streaming HTTP client and server implementation for ReactPHP

HTTP Event-driven, streaming HTTP client and server implementation for ReactPHP. This HTTP library provides re-usable implementations for an HTTP clie

ReactPHP 640 Dec 29, 2022
Requests for PHP is a humble HTTP request library. It simplifies how you interact with other sites and takes away all your worries.

Requests for PHP Requests is a HTTP library written in PHP, for human beings. It is roughly based on the API from the excellent Requests Python librar

null 3.5k Dec 31, 2022
Requests for PHP is a humble HTTP request library. It simplifies how you interact with other sites and takes away all your worries.

Requests for PHP Requests is a HTTP library written in PHP, for human beings. It is roughly based on the API from the excellent Requests Python librar

null 3.5k Dec 31, 2022
Requests - a HTTP library written in PHP, for human beings

Requests is a HTTP library written in PHP, for human beings. It is roughly based on the API from the excellent Requests Python library. Requests is ISC Licensed (similar to the new BSD license) and has no dependencies, except for PHP 5.6+.

WordPress 3.5k Jan 6, 2023
LittleProxy is a high performance HTTP proxy written in Java atop Trustin Lee's excellent Netty event-based networking library

LittleProxy is a high performance HTTP proxy written in Java atop Trustin Lee's excellent Netty event-based networking library

null 1.9k Dec 26, 2022
The Library for HTTP Status Codes, Messages and Exception

This is a PHP library for HTTP status codes, messages and error exception. Within the library, HTTP status codes are available in classes based on the section they belong to. Click this link for more information.

Sabuhi Alizada 5 Sep 14, 2022
HTTP header kit for PHP 7.1+ (incl. PHP 8) based on PSR-7

HTTP header kit for PHP 7.1+ (incl. PHP 8) based on PSR-7 Installation composer require sunrise/http-header-kit How to use? HTTP Header Collection Mor

Sunrise // PHP 63 Dec 31, 2022
Express.php is a new HTTP - Server especially made for RESTful APIs written in PHP.

express.php Express.php is a new HTTP - Server especially made for RESTful APIs written in PHP. Features Fast The Library is handles requests fast and

null 5 Aug 19, 2022