PHPackages                             realo/api-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. realo/api-client

ActiveLibrary

realo/api-client
================

Official Realo API client

v1.0.4(8mo ago)424.5k3[1 PRs](https://github.com/realo-com/api-client/pulls)MITPHPPHP &gt;=8.0

Since May 17Pushed 8mo ago7 watchersCompare

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

READMEChangelog (5)DependenciesVersions (6)Used By (0)

Realo API PHP Library
=====================

[](#realo-api-php-library)

The official PHP library for using [the Realo REST API](https://api.realo.com/docs).

Before using this library, you must have a valid API Key. To get an API Key, please contact your Realo customer success manager.

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

[](#installation)

### As a composer dependency (Recommended)

[](#as-a-composer-dependency-recommended)

The recommended way to install the Realo PHP API client is through [composer](https://getcomposer.org/download/).

Next, run the `composer` command to install the Realo PHP API client:

```
composer require realo/api-client
```

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

```
require_once __DIR__ . '/vendor/autoload.php';
```

### As a Phar

[](#as-a-phar)

You may download a ready-to-use version of the Realo API client library as a Phar from our [releases](https://github.com/realo-com/api-client/releases). This includes the API client and all its dependencies.

After downloading, you need to require the bundled autoloader:

```
require_once 'phar://' . __DIR__ . '/realo-api-client.phar/vendor/autoload.php';
```

Initialization
--------------

[](#initialization)

#### RealoApi::create(publicKey, privateKey, environment)

[](#realoapicreatepublickey-privatekey-environment)

- `publicKey`
    - Type: `string`
    - API public key
- `privateKey`
    - Type: `string`
    - API private key
- `environment`
    - Type: `string`
    - Default value: `production`
    - API environment (either `production` or `sandbox`)

#### RealoApi::createWithClient(publicKey, privateKey, client)

[](#realoapicreatewithclientpublickey-privatekey-client)

- `publicKey`
    - Type: `string`
    - API public key
- `privateKey`
    - Type: `string`
    - API private key
- `client`
    - Type: `GuzzleHttp\Client`
    - Guzzle HTTP client, used for communicating with the REST API

Methods
-------

[](#methods)

### request(path, method, \[, payload \[, headers\]\])

[](#requestpath-method--payload--headers)

- `path`
    - Type: `string`
    - The path of the resource
- `method`
    - Type: `string`
    - HTTP method for request
- `payload`
    - Type: `array`
    - HTTP payload (to be encoded as JSON), only applies when the HTTP method is not `GET`
- `headers`
    - Type: `array`
    - Custom headers to be sent with the request.

Examples
--------

[](#examples)

### Use The Bundled CLI Tool

[](#use-the-bundled-cli-tool)

We provide a simple CLI utility which you can use to interact with our API.

```
$ php example/simple-cli.php --public-key=xxx --private-key=xxx /valuations/xxx/data/mobility
{
    "data": {
        "mobilityScore": 0.88,
        "distanceToCityCenter": 3130,
        "distanceToBusStop": 323,
        "distanceToTrainStation": 1197,
        "distanceToSchool": 77,
        "distanceToStores": 33,
        "distanceToHighways": 3282,
        "buildingDensity": 1688.01,
        "inhabitantsDensity": 32346.18,
        "transitTypeCityCenter": "cycling-distance",
        "transitTypeBusStop": "walking-distance",
        "transitTypeTrainStation": "walking-distance",
        "transitTypeSchool": "walking-distance",
        "transitTypeStores": "walking-distance"
    }
}
```

### Send An API Call Using The Request Function

[](#send-an-api-call-using-the-request-function)

We provide a base request function to access any of our API resources.

```
use Realo\Api\RealoApi;
use Realo\Api\RealoApiException;

$api = RealoApi::create('YOUR_PUBLIC_KEY', 'YOUR_PRIVATE_KEY');
try {
    $response = $api->request('/agencies', 'GET');
    var_dump($response);
} catch (RealoApiException $e) {
    printf("Error %d: %s\n", $e->getCode(), $e->getMessage());
}
```

Exceptions
----------

[](#exceptions)

An exception will be thrown in two cases: there is a problem with the request or the server returns a status code of `400` or higher.

### RealoApiException

[](#realoapiexception)

- **getCode()**
    - Returns the response status code of `400` or higher.
- **getMessage()**
    - Returns the exception message.
- **getErrors()**
    - If there is a response body containing an `array` of errors, return these. Otherwise returns `null`.
- **getType()**
    - If there is a response body containing an error, return its type. Otherwise returns `null`.

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance60

Regular maintenance activity

Popularity26

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 71.4% 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 ~757 days

Total

5

Last Release

255d ago

PHP version history (2 changes)v1.0PHP &gt;=5.6

v1.0.4PHP &gt;=8.0

### Community

---

Top Contributors

[![mcuelenaere](https://avatars.githubusercontent.com/u/1682432?v=4)](https://github.com/mcuelenaere "mcuelenaere (15 commits)")[![V1ncent](https://avatars.githubusercontent.com/u/6650996?v=4)](https://github.com/V1ncent "V1ncent (5 commits)")[![aviv-warrevandeveire](https://avatars.githubusercontent.com/u/230168540?v=4)](https://github.com/aviv-warrevandeveire "aviv-warrevandeveire (1 commits)")

### Embed Badge

![Health badge](/badges/realo-api-client/health.svg)

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

PHPackages © 2026

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