PHPackages                             jamiecressey/restful-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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. jamiecressey/restful-client

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

jamiecressey/restful-client
===========================

Generic RESTful API Client

0.9.0(10y ago)018MITPHPPHP &gt;=5.4.0

Since Oct 15Pushed 10y ago1 watchersCompare

[ Source](https://github.com/JamieCressey/php-restful-client)[ Packagist](https://packagist.org/packages/jamiecressey/restful-client)[ Docs](https://github.com/JamieCressey/php-restful-client)[ RSS](/packages/jamiecressey-restful-client/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

[![Build Status](https://camo.githubusercontent.com/6341ae230f74edff25b8f85f9386de3776cba8e1e6e3ed35978032b93a56a550/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f4a616d6965437265737365792f7068702d7265737466756c2d636c69656e742e737667)](https://travis-ci.org/JamieCressey/php-restful-client)[![Package Version](https://camo.githubusercontent.com/0d494ac031fa11c6c6a9d469bbf47ea2d4883e49f43bd4f2869f09272295b3c7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a616d6965637265737365792f7265737466756c2d636c69656e742e737667)](https://packagist.org/packages/jamiecressey/restful-client)[![Package Downloads](https://camo.githubusercontent.com/285a7530426ad7e6fbbc8d98410cc4ccb146831bde46d4d8e3d4c11eda645c60/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6a616d6965637265737365792f7265737466756c2d636c69656e742e737667)](https://packagist.org/packages/jamiecressey/restful-client)

Generic RESTful PHP client
==========================

[](#generic-restful-php-client)

A generic RESTful PHP client for interacting with JSON APIs.

Usage
-----

[](#usage)

To use this client you just need to import ApiClient and initialize it with an API Key, Secret and URL endpoint

```
$api = new RestfulClient\ApiClient('#your_api_key', '#your_api_secret', '#your_api_endpoint');

```

Now that you have a RESTful API object you can start sending requests.

Request Authentication
----------------------

[](#request-authentication)

All requests include the following headers by default:

- 'X-Authentication-Key' - The API Key provided when creating the ApiClient object.
- 'X-Authentication-Nonce' - An incremental number to prevent request replays. By default this is the current epoch time in milliseconds.
- 'X-Authentication-Signature' - A SHA512 HMAC signature of the nonce, signed using the API Secret provided when creating the ApiClient object.

Making a request
----------------

[](#making-a-request)

The framework supports GET, PUT, POST and DELETE requests:

```
$api->get('/books/');
$api->post('/books/', array('title' => 'Twilight', 'author' => 'Stephenie Meyer'));
$api->put('/book/Twilight/', array('release_date' => '06/09/2006'));
$api->delete('/book/Twilight/');

```

Verifying Requests
------------------

[](#verifying-requests)

Two helpers are built in to verify the success of requests made. `ok()` checks for a 20x status code and returns a boolean, `errors()` returns the body content as an associative array if the status code is not 20x:

```
$req = $api->get('/books/');

if( $req->ok() ) {
    echo 'Success!';
} else {
    echo $req->errors();
}

```

Extending the client
--------------------

[](#extending-the-client)

The client can be extended to be more application specific, e.g. `$api->create_book('Twilight', 'Stephenie Meyer');`:

```
class YourAPI extends \RestfulClient\ApiClient
{
    public function __construct($api_key, $api_secret)
    {
        $api_url = 'https://api.yourdomain.com'
        parent::__construct($api_key, $api_secret, $api_url);
    }

    public function create_book($title, $author)
    {
        $data = array(
            'title' => $title,
            'author' => $author,
        );

        return $this->post('/books/', $data);
    }
}

```

Contributing
------------

[](#contributing)

All contributions are welcome, either for new\\improved functionality or in response to any open bugs.

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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

Unknown

Total

1

Last Release

3916d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9d11f2e76de7ba7b3ebe3df115f6e81842fb6b7f0896189c53f2116fd3f35e3c?d=identicon)[jayc89](/maintainers/jayc89)

---

Top Contributors

[![JamieCressey](https://avatars.githubusercontent.com/u/6462914?v=4)](https://github.com/JamieCressey "JamieCressey (4 commits)")

---

Tags

apiAuthentication

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jamiecressey-restful-client/health.svg)

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

###  Alternatives

[google/auth

Google Auth Library for PHP

1.4k294.2M220](/packages/google-auth)[ellaisys/aws-cognito

Laravel Authentication using AWS Cognito (Web and API)

123256.9k1](/packages/ellaisys-aws-cognito)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

273.0k](/packages/eslazarev-wildberries-sdk)[files.com/files-php-sdk

Files.com PHP SDK

2481.1k](/packages/filescom-files-php-sdk)[descope/descope-php

Descope SDK for PHP

4223.8k](/packages/descope-descope-php)

PHPackages © 2026

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