PHPackages                             reliefweb/api-php-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. [API Development](/categories/api)
4. /
5. reliefweb/api-php-client

ActiveApplication[API Development](/categories/api)

reliefweb/api-php-client
========================

Really simple php client for the ReliefWeb API.

v1.5.0(6y ago)0612[1 PRs](https://github.com/UN-OCHA/rwint-api-php-client/pulls)PHP &gt;=5.3.3

Since Oct 25Pushed 2y agoCompare

[ Source](https://github.com/UN-OCHA/rwint-api-php-client)[ Packagist](https://packagist.org/packages/reliefweb/api-php-client)[ RSS](/packages/reliefweb-api-php-client/feed)WikiDiscussions master Synced 5d ago

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

RefiefWeb API - PHP Client
==========================

[](#refiefweb-api---php-client)

Really simple php client for the ReliefWeb API (v1).

API url
-------

[](#api-url)

API documentation
-----------------

[](#api-documentation)

See the [ReliefWeb API documentation](https://reliefweb.int/help/api).

Install
-------

[](#install)

Run `composer install --no-dev -o`.

Usage
-----

[](#usage)

See examples below and read functions details in src/RWAPIClient.

Examples
--------

[](#examples)

```
// Include autoloader.
include 'vendor/autoload.php';

// Create a client.
$client = new \RWAPIClient\Client();

// Set the name of the application or website using the API.
$client->appname('example.com');

// Create a query to a resource.
$query = new \RWAPIClient\Query('reports', $client);

// Set the number of document to return.
$query->limit(10);

// Set the fields to include in the results.
$query->fields(array('title', 'theme', 'country', 'source'));

// Set the how the results should be sorted.
$query->sort('date', 'desc');

// Add a query string on the title and body fields.
$query->search('humanitarian', array('title', 'body'));

// Create a conditional filter.
$filter = new \RWAPIClient\Filter();
$filter->condition('date', array('from' => '2013-10-01T00:00:00+00:00'));

// Create a nested filter.
$nested_filter = new \RWAPIClient\Filter('OR');
$nested_filter->condition('theme', array('agriculture', 'health'), 'AND');
$nested_filter->condition('source', array('ocha', 'unhcr'), 'OR');
$filter->filter($nested_filter);

// Add the fitler to the query.
$query->filter($filter);

// Create a facet on countries ordered by name.
$facet = new \RWAPIClient\Facet('country', 'country', 250);
$facet->sort('value', 'asc');

// Add the country facet to the query.
$query->facets($facet);

// Create a facet on sources ordered by count (10 most).
$facet = new \RWAPIClient\Facet('organization', 'source', 10);

// Add the souce facet to the query.
$query->facets($facet);

// Run the query.
$results = $query->execute();

// Display the title of the returned resource items.
$items = $results->items();
foreach ($items as $item) {
  echo $item['fields']['title'] . "\n";
}

// Display the source facet items.
$organizations = $results->facet('organization');
foreach ($organizations['data'] as $organization) {
  echo $organization['value'] . ' - ' . $organization['count'] . "\n";
}
```

To get a single resource item:

```
// Include autoloader.
include 'vendor/autoload.php';

// Create a client.
$client = new \RWAPIClient\Client();

// Set the name of the application or website using the API.
$client->appname('example.com');

// Create a query to a resource.
$query = new \RWAPIClient\Query('reports', $client);

// Get the resource item (with minimal profile).
$item = $query->id(548925)->profile('minimal')->execute()->item();

// Display the item title.
echo $item['fields']['title'] . "\n";
```

Hypermedia
----------

[](#hypermedia)

The ReliefWeb API contains hypermedia links which are useful when exploring the API resources. Example:

```
{
  "href": "https://api.reliefweb.int/v1/reports/2905933"
}
```

They can be turned on by setting:

```
$client->hypermedia(TRUE);
```

**Note:** Those hypermedia links were originally always returned by this client but not used anywhere. Thus, they are now turned off by default to reduce bandwidth usage.

Dependencies
------------

[](#dependencies)

Ensure no dev dependencies are added when committed by running `composer install --no-dev -o`.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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

Every ~385 days

Recently: every ~246 days

Total

6

Last Release

2293d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/346443feed98de86efcea04bbc5094dc2a4146181bca1e8936beb6ac46eed455?d=identicon)[unocha](/maintainers/unocha)

---

Top Contributors

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

---

Tags

phpapireliefweb

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[jstolpe/instagram-graph-api-php-sdk

Instagram Graph API PHP SDK

13998.4k2](/packages/jstolpe-instagram-graph-api-php-sdk)

PHPackages © 2026

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