PHPackages                             chriha/rest-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. chriha/rest-client

AbandonedArchivedProject[HTTP &amp; Networking](/categories/http)

chriha/rest-client
==================

Simple PHP REST client

0.6.4(9y ago)14491[1 issues](https://github.com/chriha/rest-client/issues)MITPHPPHP &gt;=5.5.0

Since May 7Pushed 9y ago1 watchersCompare

[ Source](https://github.com/chriha/rest-client)[ Packagist](https://packagist.org/packages/chriha/rest-client)[ RSS](/packages/chriha-rest-client/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (10)Dependencies (2)Versions (17)Used By (0)

rest-client
===========

[](#rest-client)

[![Build Status](https://camo.githubusercontent.com/79abf43168559a1fabbf5c24aae4c9d535131177766de18e9f83e594d71d86f4/68747470733a2f2f7472617669732d63692e6f72672f6368726968612f726573742d636c69656e742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/chriha/rest-client)

A simple REST client with PHPs cURL.

Install
-------

[](#install)

```
composer require chriha/rest-client

```

Usage
-----

[](#usage)

Define your options

```
$options = [
    'url' => 'http://api.localhost/v1',
];
```

See `\Chriha\Clients\Rest::getDefaultOptions()` for all default options.

#### GET

[](#get)

```
$rest = new \Chriha\Clients\Rest( $options );
$rest->get( '/posts' );
```

#### POST

[](#post)

```
$post = [
    "title" => "lorem",
    "body"  => "lorem ipsum dolor set"
];

$rest = new \Chriha\Clients\Rest( $options );
$rest->post( '/posts', $post );
```

#### PUT / PATCH

[](#put--patch)

```
$post = [
    "title" => "lorem"
];

$rest = new \Chriha\Clients\Rest( $options );
$rest->put( '/posts/1', $post );
$rest->patch( '/posts/1', $post );
```

#### DELETE

[](#delete)

```
$rest = new \Chriha\Clients\Rest( $options );
$rest->delete( '/posts/1' );
```

Options
-------

[](#options)

#### Allow self signed certificates

[](#allow-self-signed-certificates)

Recommended only in dev environment, so default is `false`

```
$options = [
    'allow_self_signed' => true,
];
```

#### Set additional cURL options

[](#set-additional-curl-options)

```
$options = [
    'curl_options' => [...],
];
```

#### OAuth 1.0 authentication

[](#oauth-10-authentication)

```
$options = [
    'authentication' => 'oauth1',
    'token'          => 'YOUR_API_TOKEN',
    'secret'         => 'YOUR_API_SECRET',
];
```

Using the CLI rest client
-------------------------

[](#using-the-cli-rest-client)

Make an alias like `alias rest='vendors/bin/rest'` for simpler usage of the client inside the project.

With the following command you can do a request via the rest client.

```
$ ./rest GET http://api.localhost.io/v1/posts "parameters=specified&as=simple&query=string" "Content-Type:application/json;Accept-Charset: utf-8"
```

If you want to use `token` and `secret` for your authentication, you can place them as JSON in the `.rest` file of your project root:

```
{
    "token": "YOUR_API_TOKEN",
    "secret": "YOUR_API_SECRET"
}
```

The output of the rest client will be shown as the following:

```
Request took 23.45ms
Response Code: 200
Response Body:
{
    "meta": "info",
    "data": [
        {
            "title": "lorem"
        }
    ]
}

```

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~21 days

Recently: every ~59 days

Total

15

Last Release

3403d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0a593d81eb5101c5d9500de7203ccb540930b398f2dc342b0bb10db297cad886?d=identicon)[chriha](/maintainers/chriha)

---

Tags

clientphprestrest-apiclientrest

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/chriha-rest-client/health.svg)

```
[![Health](https://phpackages.com/badges/chriha-rest-client/health.svg)](https://phpackages.com/packages/chriha-rest-client)
```

###  Alternatives

[pdffiller/pdffiller-php-api-client

PHP client for pdffiller.com REST API

14145.0k](/packages/pdffiller-pdffiller-php-api-client)[chsergey/yii2-rest-client

REST client (AR-like model) for Yii Framework 2.0 (via GuzzleHttp)

1511.5k](/packages/chsergey-yii2-rest-client)[opiy-org/asterisk-ari-php

An object-oriented client for the Asterisk REST Interface (ARI). Handles ARI calls and events for you.

111.2k](/packages/opiy-org-asterisk-ari-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
