This package is abandoned and no longer maintained. No replacement package was suggested.

A http client library without any dependencies. Just vanilla php.

1.1.0 2019-03-14 16:18 UTC

This package is auto-updated.

Last update: 2024-01-15 03:34:15 UTC


Latest Stable Version Latest Unstable Version License Total Downloads

This http client library does not have any dependencies like curl or guzzle. It uses plain php functions to handle the most common http requests.


composer require rokde/http-client


You have two options

  1. Use the helper function http()
  2. Use the full-blown class stack provided by the package

I recommend the use of the http() function to keep the packages purpose in mind: simplicity.

Using http()

// GET (get from uri)
/** @var string $response */
$response = http('');

// POST (post data to uri)
/** @var \Rokde\HttpClient\Response $response */
$response = http()->post(['data' => 'value'], '');

Using the class version

$client = new \Rokde\HttpClient\Client();

$request = new \Rokde\HttpClient\Request('', 'GET', [
  'accept' => 'application/json',
  'x-verify-test' => 'true',

$response = $client->send($request);

if ($response->isOk()) {
  $resultString = $response->content();

Further usage examples can be found at the /tests folder of this package.


Run the tests with:

composer test