PHP 5.4+


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';


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');

$response = Unirest\Request::post("API_URL",
    "X-RapidAPI-Key" => "API_KEY"