PHPackages                             abhilashpujari/php-restservice - 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. abhilashpujari/php-restservice

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

abhilashpujari/php-restservice
==============================

Simple PHP Wrapper class for making REST API calls

v2.0.2(5y ago)36093[1 issues](https://github.com/abhilashpujari/php-restservice/issues)[7 PRs](https://github.com/abhilashpujari/php-restservice/pulls)MITPHPPHP &gt;=7.2CI failing

Since Apr 22Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/abhilashpujari/php-restservice)[ Packagist](https://packagist.org/packages/abhilashpujari/php-restservice)[ RSS](/packages/abhilashpujari-php-restservice/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (3)Dependencies (2)Versions (19)Used By (0)

PHP HTTP REST Client
====================

[](#php-http-rest-client)

[![CI build](https://github.com/abhilashpujari/php-restservice/workflows/CI%20build/badge.svg)](https://github.com/abhilashpujari/php-restservice/workflows/CI%20build/badge.svg)[![Lint Code Base](https://github.com/abhilashpujari/php-restservice/workflows/Lint%20Code%20Base/badge.svg?branch=super-linter)](https://github.com/abhilashpujari/php-restservice/workflows/Lint%20Code%20Base/badge.svg?branch=super-linter)

Simple PHP Client library that makes it easy to make REST API calls. It uses [Guzzle Client](http://docs.guzzlephp.org/en/stable/) as a dependencies

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

[](#installation)

The recommended way to install this library is through [Composer](http://getcomposer.org).

```
# Install Composer
curl -sS https://getcomposer.org/installer | php
```

Next, run the Composer command to install the latest stable version of this library:

```
php composer.phar require abhilashpujari/php-restservice dev-master
```

After installing, you need to require Composer's autoloader:

```
require 'vendor/autoload.php';
```

You can then later update this library using composer:

```
php composer.phar update
```

Usage
-----

[](#usage)

1 GET Request

```
use RestService\RestService;

$restService = new RestService();
$response = $restService
    ->setEndpoint('https://jsonplaceholder.typicode.com')
    ->get('/posts/1');
```

2 POST Request

```
$restService
     ->setEndpoint('https://jsonplaceholder.typicode.com')
     ->post('/posts');
```

3 PUT Request

```
$restService
     ->setEndpoint('https://jsonplaceholder.typicode.com')
     ->put('/posts/1',
         [
             'id' => 1,
             'text' => 'Test'
         ]
     );
```

4 PATCH Request

```
$restService
     ->setEndpoint('https://jsonplaceholder.typicode.com')
     ->patch('/posts/1',
         [
             'id' => 1,
             'text' => 'Test'
         ]
     );
```

5 DELETE Request

```
$restService
     ->setEndpoint('https://jsonplaceholder.typicode.com')
     ->delete('/posts/1');
```

6 A fire and forget request which is useful in scenario where we fire the request and aren't concerned of the response, it can be done by setting setIsFireAndForget(true)

```
$restService
     ->setEndpoint('https://jsonplaceholder.typicode.com')
     ->setIsFireAndForget(true)
     ->post('/posts');
```

7 Request with some custom headers, , it can be done by setting setRequestHeaders(headers array)

```
$restService
     ->setEndpoint('https://jsonplaceholder.typicode.com')
     ->setRequestHeaders([
         'auth' => 'somevalue'
     ])
     ->post('/posts');
```

8 Request in which we need the response data which includes status code, headers, body etc, which can be done by setting request method 4th parameter to false

```
$response = $restService
     ->setEndpoint('https://jsonplaceholder.typicode.com')
     ->get('/posts/1', [], [], false);

 var_dump($response->getHeaders());
 var_dump($response->getBody());
```

9 PURGE Request (Can be used for cache invalidation Eg:: varnish, nginx cache)

```
use RestService\RestService;

$restService = new RestService();
$response = $restService
    ->setEndpoint('https://jsonplaceholder.typicode.com')
    ->purge('/posts/1');
```

### License

[](#license)

This project is licensed under the MIT License

###  Health Score

42

—

FairBetter than 89% of packages

Maintenance58

Moderate activity, may be stable

Popularity19

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 84.9% 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

Every ~112 days

Recently: every ~223 days

Total

9

Last Release

2044d ago

Major Versions

v1.0.5 → v2.02020-07-03

PHP version history (5 changes)v1.0PHP &gt;= 5.4

v1.0.4PHP &gt;= 5.5

v1.0.5PHP &gt;= 5.6

v2.0PHP &gt;=7.1

v2.0.1PHP &gt;=7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/3d38782e2e95b033099c3cc07a822dfef5b311d59d77629193f0650450442600?d=identicon)[abhilashpujari](/maintainers/abhilashpujari)

---

Top Contributors

[![abhilashpujari](https://avatars.githubusercontent.com/u/8478346?v=4)](https://github.com/abhilashpujari "abhilashpujari (62 commits)")[![renovate-bot](https://avatars.githubusercontent.com/u/25180681?v=4)](https://github.com/renovate-bot "renovate-bot (8 commits)")[![abhilashwebnapp](https://avatars.githubusercontent.com/u/8745510?v=4)](https://github.com/abhilashwebnapp "abhilashwebnapp (3 commits)")

---

Tags

api-clientcomposerguzzlehttpphprest-clienthttpphpclientrestcurlhttp client

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/abhilashpujari-php-restservice/health.svg)

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

###  Alternatives

[zoonman/pixabay-php-api

PixabayClient is a PHP HTTP client library to access Pixabay's API

3354.7k](/packages/zoonman-pixabay-php-api)[e-moe/guzzle6-bundle

Integrates Guzzle 6 into your Symfony application

11259.2k](/packages/e-moe-guzzle6-bundle)[opgg/riotquest

RiotQuest, PHP RiotAPI client library that focused on multi request from OP.GG

172.6k](/packages/opgg-riotquest)

PHPackages © 2026

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