PHPackages                             ocjojo/op-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. [API Development](/categories/api)
4. /
5. ocjojo/op-restclient

ActiveLibrary[API Development](/categories/api)

ocjojo/op-restclient
====================

A generic REST API client for PHP using objects to compose requests

0.0.1(8y ago)020MITPHP

Since Sep 3Pushed 8y ago1 watchersCompare

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

READMEChangelogDependencies (1)Versions (2)Used By (0)

OP-Restclient
=============

[](#op-restclient)

**O**OP - Object-oriented programming
**P**HP
**REST-Client**

A generic REST API client for PHP using objects to compose requests. This is based on and extends the excellent [tcdent/php-restclient](https://github.com/tcdent/php-restclient).

(c) 2017 Lukas Ehnle

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

[](#installation)

```
$ composer require ocjojo/op-restclient
```

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

[](#basic-usage)

```
$api = new OPRestclient\Client([
    'base_url' => "https://jsonplaceholder.typicode.com"
]);
// GET https://jsonplaceholder.typicode.com/posts/1?param_1=hello&param_2=world
$result = $api->posts->{1}->get([
	'param_1' => "hello",
	'param_2' => "world"
]);
if($result->info->http_code == 200)
    var_dump($result->decode_response());
```

Options for the client
----------------------

[](#options-for-the-client)

See the documentation of [tcdent/php-restclient](https://github.com/tcdent/php-restclient) for the configurable options. OPRestClient extends tcdent's RestClient, so all options and methods apply equally.

Standard Parameters
-------------------

[](#standard-parameters)

You are able to set standard parameters for consecutive requests to the same endpoint, e.g. if you want access data at an endpoint with paging. Like so:

```
$api = new OPRestClient\Client([
    'base_url' => "https://api.twitter.com/1.1",
    'format' => "json",
     // https://dev.twitter.com/docs/auth/application-only-auth
    'headers' => ['Authorization' => 'Bearer '.OAUTH_BEARER]
]);

$api->search->tweets['q'] = '#php';
//both results will have the query parameter q set to '#php'
$result = $api->search->tweets->get(['page' => '1']);
$result2 = $api->search->tweets->get(['page' => '2']);

// to delete a standard parameter of a route
unset($api->search->tweets['q']);

// to delete all standard parameters of a route
$api->search->tweets->reset();
```

Standard Parameters will be set until you unset them manually.

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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

3214d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6cedc0cda77789f107128506cb00a0c513ea628893cae62d660d6afc8e0ebf10?d=identicon)[ocjojo](/maintainers/ocjojo)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/ocjojo-op-restclient/health.svg)

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

###  Alternatives

[hubspot/api-client

Hubspot API client

24015.5M18](/packages/hubspot-api-client)[botman/driver-telegram

Telegram driver for BotMan

93452.6k6](/packages/botman-driver-telegram)[serpwow/google-search-results

Google Search Results PHP package via SerpWow.com

1931.8k1](/packages/serpwow-google-search-results)

PHPackages © 2026

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