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

ActiveLibrary[API Development](/categories/api)

nonsoniyi/the-guardian-api-client
=================================

PHP wrapper for the guardian APIs

v1.0.4(2y ago)61.3k21MITPHPPHP ^7.4 || ^8.0

Since Aug 4Pushed 2y ago2 watchersCompare

[ Source](https://github.com/niyiomotoso/the-guardian-api-php-client)[ Packagist](https://packagist.org/packages/nonsoniyi/the-guardian-api-client)[ Docs](https://github.com/niyiomotoso/the-guardian-api-php-client)[ RSS](/packages/nonsoniyi-the-guardian-api-client/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (2)Dependencies (2)Versions (5)Used By (1)

The Guardian API PHP Client
===========================

[](#the-guardian-api-php-client)

PHP client library for the Guardian APIs. See documentation [here](https://open-platform.theguardian.com/documentation/). All available API modules are supported - Content, Tags, Sections, Editions, and Single Item.

### Installation

[](#installation)

You can install this package with composer using the command below

```
 composer require nonsoniyi/the-guardian-api-client
```

### Get API key

[](#get-api-key)

Sign up for an API key [here](https://open-platform.theguardian.com/access)

### Making Requests

[](#making-requests)

The primary `Guardian\GuardianAPI` class is a factory class that creates objects for each of the API modules, allowing you to make requests to any of them with your desired request parameters. You have to first create an object for it, then access your desired API module via the object. See the code snippets below:

```
$api = new Guardian\GuardianAPI(THE_GUARDIAN_API_KEY);
```

**For Content:**

```
$response = $api->content()
    ->setQuery("12 years a slave")
    ->setTag("film/film,tone/reviews")
    ->setFromDate(new DateTimeImmutable("01/01/2010"))
    ->setToDate(new \DateTimeImmutable())
    ->setShowTags("contributor")
    ->setShowFields("starRating,headline,thumbnail,short-url")
    ->setOrderBy("relevance")
    ->fetch();
```

**For Tags:**

```
$response = $api->tags()
    ->setQuery("apple")
    ->setSection("technology")
    ->setShowReferences("all")
    ->fetch();
```

**For Sections:**

```
$response = $api->sections()
    ->setQuery("business")
    ->fetch();
```

**For Editions:**

```
$response = $api->editions()
    ->setQuery("uk")
    ->fetch();
```

**For Single Item:**

```
$response = $api->singleItem()
    ->setId("/sport/2022/oct/07/cricket-jos-buttler-primed-for-england-comeback-while-phil-salt-stays-focused")
    ->setShowStoryPackage(true)
    ->setShowEditorsPicks(true)
    ->setShowMostViewed(true)
    ->setShowRelated(true)
    ->fetch();
```

### Community support

[](#community-support)

You can reach out to us on the Google Group here  for support

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 93.2% 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 ~284 days

Total

2

Last Release

773d ago

PHP version history (2 changes)1.0.3PHP ^7.2 || ^8.0

v1.0.4PHP ^7.4 || ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5949621?v=4)[omoniyi](/maintainers/omoniyi)[@omoniyi](https://github.com/omoniyi)

---

Top Contributors

[![niyiomotoso](https://avatars.githubusercontent.com/u/6876434?v=4)](https://github.com/niyiomotoso "niyiomotoso (109 commits)")[![Kingdageek](https://avatars.githubusercontent.com/u/22563387?v=4)](https://github.com/Kingdageek "Kingdageek (8 commits)")

---

Tags

apiwrapperThe Guardian

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/nonsoniyi-the-guardian-api-client/health.svg)

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

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3661.2M46](/packages/tencentcloud-tencentcloud-sdk-php)[gabrielbull/ups-api

PHP UPS API

4582.4M10](/packages/gabrielbull-ups-api)[files.com/files-php-sdk

Files.com PHP SDK

2478.1k](/packages/filescom-files-php-sdk)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

252.5k](/packages/eslazarev-wildberries-sdk)[dariusiii/tmdb-laravel

Laravel Package for TMDB ( The Movie Database ) API. Provides easy access to the wtfzdotnet/php-tmdb-api library.

1821.1k](/packages/dariusiii-tmdb-laravel)[walle89/swedbank-json

Unofficial API client for the Swedbank's and Sparbanken's mobile apps in Sweden.

772.5k](/packages/walle89-swedbank-json)

PHPackages © 2026

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