PHPackages                             pbmengine/php-restclient - 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. pbmengine/php-restclient

ActiveLibrary

pbmengine/php-restclient
========================

Generic PHP client to access REST APIs

0.9.7(6y ago)046MITPHPPHP ^7.2.0CI failing

Since May 2Pushed 6y agoCompare

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

READMEChangelogDependencies (4)Versions (10)Used By (0)

Generic PHP client to access REST APIs
======================================

[](#generic-php-client-to-access-rest-apis)

[![Latest Version on Packagist](https://camo.githubusercontent.com/8868a1894e2d41ef97c14ff5337403b112173633e5e3651ebd0eba7a4cf36b7a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f70626d656e67696e652f7068702d72657374636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pbmengine/php-restclient)[![Build Status](https://camo.githubusercontent.com/3187a040b7c1c9bbcefc606912d585e6de5a1d0af1ad220df0b3d22d20bf192e/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f70626d656e67696e652f7068702d72657374636c69656e742f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/pbmengine/php-restclient)[![Quality Score](https://camo.githubusercontent.com/5def00a2e98884699eddd8d378b77cee5a2221ab8170ba85e684cecf47a94959/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f70626d656e67696e652f7068702d72657374636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/pbmengine/php-restclient)[![Total Downloads](https://camo.githubusercontent.com/31c2508bf5af9c3267b2751bae28017cbc345a4ce3bd3de09c4af0944b908da7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f70626d656e67696e652f7068702d72657374636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pbmengine/php-restclient)

This publication describes a generic api rest client suitable for all PHP packages.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require pbmengine/php-restclient
```

Basic Usage
-----------

[](#basic-usage)

```
use Pbmengine\Restclient\HttpClient;

$client = new HttpClient;

// or

$client = new HttpClient(\GuzzleHttp\Client, 'https://example.com/v1', ['timeout' => 30]);

$response = $client->get('users');
$response = $client->jsonPayload(['id' : 1])->post('users');
```

### Client Methods

[](#client-methods)

```
$client->baseUrl('https://example.com/v1');

$client->options(['http_errors' => false, 'timeout' => 30]);
$client->option('http_errors', false);

$client->authorizationBearer('token');
$client->authorizationHttp('username', 'password');
$client->authorizationDigest('username', 'password');

$client->headers(['API-KEY' => 30]);
$client->header('API-KEY', 30);

$client->queryParams(['embed' => 'resource']);
$client->queryParam('embed', 'resource');

$client->jsonPayload([]);
$client->multipartPayload([]);
$client->formParamsPayload([]);

$client->getHeaders();
$client->getQueryParams();
$client->getBody();
$client->getRequestUrl('endpoint');

$response = $client->get('users');
$response = $client->post('users');
$response = $client->put('users/12');
$response = $client->delete('users/12');
$response = $client->patch('users/12');
$response = $client->head('users/12');

```

### Response Methods

[](#response-methods)

```

$response->statusCode(); // 200
$response->headers(); // []
$response->raw(); // ResponseInterface
$response->raw()->getHeaders(); // []
$response->isValid(); // true
$response->isServerError(); // false
$response->isClientError(); // false
$response->content(); // StdClass
$response->contentAsArray(); // Array
$response->contentAsJson(); // Json String
$response->contentAsCollection(); // Illuminate Collection

```

### Use Case several requests

[](#use-case-several-requests)

```

$client = (new HttpClient)
    ->baseUrl('https://example.com')
    ->authorizationBearer('your token');

// get all users
$response = $client
    ->queryParam('embed', 'client');
    ->get('users');

// update user
$response = $client
    ->jsonPayload(['name' => 'John'])
    ->put('users/' . $response->content()->data->id);

// set new Bearer
$client->authorizationBearer('another token');

// delete user
$response = $client->delete('users/id');

```

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Stefan Riehl](https://github.com/stefanriehl)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity50

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 ~20 days

Recently: every ~1 days

Total

9

Last Release

2412d ago

PHP version history (2 changes)0.9.0PHP ^7.1.3

0.9.2PHP ^7.2.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/50110897?v=4)[PBM Personal Business Machine AG](/maintainers/pbmengine)[@pbmengine](https://github.com/pbmengine)

---

Tags

pbmpbmenginephp-restclient

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/pbmengine-php-restclient/health.svg)

```
[![Health](https://phpackages.com/badges/pbmengine-php-restclient/health.svg)](https://phpackages.com/packages/pbmengine-php-restclient)
```

###  Alternatives

[s-ichikawa/laravel-sendgrid-driver

This library adds a 'sendgrid' mail driver to Laravel.

4139.3M1](/packages/s-ichikawa-laravel-sendgrid-driver)[stechstudio/laravel-zipstream

A fast and simple streaming zip file downloader for Laravel.

4633.7M3](/packages/stechstudio-laravel-zipstream)[laravel-notification-channels/microsoft-teams

A Laravel Notification Channel for Microsoft Teams

1603.0M7](/packages/laravel-notification-channels-microsoft-teams)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[spatie/laravel-export

Create a static site bundle from a Laravel app

646127.9k5](/packages/spatie-laravel-export)[erag/laravel-disposable-email

A Laravel package to detect and block disposable email addresses.

226102.4k](/packages/erag-laravel-disposable-email)

PHPackages © 2026

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