PHPackages                             t14/open-platform-php - 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. t14/open-platform-php

ActiveLibrary[API Development](/categories/api)

t14/open-platform-php
=====================

PHP library for utzlizing the The Guardian Newspaper's Open Platform

0.1(10y ago)0272GPLPHP

Since Jul 4Pushed 10y ago1 watchersCompare

[ Source](https://github.com/t14/OpenPlatformPHP)[ Packagist](https://packagist.org/packages/t14/open-platform-php)[ RSS](/packages/t14-open-platform-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (4)Used By (0)

Master [![Build Status](https://camo.githubusercontent.com/ef96dddc312063bdc4d7cad88f5089c7d132393914acb8317b64eeec2c3a2588/68747470733a2f2f7472617669732d63692e6f72672f7431342f4f70656e506c6174666f726d5048502e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/t14/OpenPlatformPHP.svg?branch=master)Dev [![Build Status](https://camo.githubusercontent.com/8c6202ef6038a8c2f2c28ceffd6e179a2cd0d06fb902e84f05a6385f30fd7d45/68747470733a2f2f7472617669732d63692e6f72672f7431342f4f70656e506c6174666f726d5048502e7376673f6272616e63683d646576)](https://travis-ci.org/t14/OpenPlatformPHP.svg?branch=dev)

\#Guardian Open Platform PHP Client

This is a PHP based client library that aims to provide an easy to use option for consuming The Guardian NewsPapers [Open Platform API](http://open-platform.theguardian.com/).

\#Before you get started Before you get started you need to get an api key which you can obtain [here](http://open-platform.theguardian.com/access/)

\##Installation Using composer `composer require t14/open-platform-php`Create a config.yml file like the one below and add your api key.

```
# Open Platform Config
- host:
  - 'http://content.guardianapis.com'
- apiKey:
  - 'YOUR API KEY HERE'

```

\##Basic Usage Edit the config.yml file and replace the api key with your own. You can choose to use a different YAML config file (see the config section below)

```
require 'vendor/autoload.php';
use OpenPlatform\Client;

$op = new Client('DIR_OF_CONFIG_FILE/config.yml');

$op->endpoint('search')
   ->filter('politics', 'section')
   ->filter('newest', 'order-by')
   ->searchQuery('latest election news')
   ->getContent()->getBody();
```

The `getContent()` returns a Guzzle client object making it possible to chain a different method other than `getBody()`[See Guzzle documentation for more information](http://docs.guzzlephp.org/en/latest/request-options.html)

The `searchQuery('my free text search')` method allows you to add a free text search to your query. You also have the option to specify filters and use different endpoints.

\##Endpoints You can query a different endpoint by passing the name of the endpoint as a parameter to the `endpoint('nameOfEndpoint')` method. For example to query the sections endpoint you could do the following

```
$op->endpoint('sections')
   ->searchQuery('business')
   ->getContent()->getBody();
```

\##Filters You can chain the `filter` method to the `endpoint` method and then to its self allowing you to set multiple filters. Each endpoint supports certain filters and an exception will be thrown if you try to use an incompatible filter to to check which filters are supported by which endpoint you can use the [content explorer](open-platform.theguardian.com)

The filter method takes a query as its first parameter and the name of the filter you want to use as its second parameter. For example if you would like to use the 'search' endpoint and filter your results to only show a single page, ordered by the most recent from the 'politics' section you could do the following;

```
$op->endpoint('search')
    ->filter('politics', 'section')
    ->filter('newest', 'order-by')
    ->filter(1, 'page')
    ->getContent()->getBody();
```

\##Useful resources This library is largely based on the Open Platform [content explorer](open-platform.theguardian.com). You can use it to help you find out which filters are compatible with which endpoints, see what kind of results your queries return and more. open-platform.theguardian.com

\##Contributing Please feel free to fork this repo and open a pull request.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 88.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

Unknown

Total

1

Last Release

3971d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/615735ab30bac94a270605eb2fe6d202de50691773ae9bdfec29d42560a7fd37?d=identicon)[t14](/maintainers/t14)

---

Top Contributors

[![no-replies](https://avatars.githubusercontent.com/u/44973575?v=4)](https://github.com/no-replies "no-replies (8 commits)")[![t14](https://avatars.githubusercontent.com/u/1374615?v=4)](https://github.com/t14 "t14 (1 commits)")

---

Tags

openPlatform

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/t14-open-platform-php/health.svg)

```
[![Health](https://phpackages.com/badges/t14-open-platform-php/health.svg)](https://phpackages.com/packages/t14-open-platform-php)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[statamic/cms

The Statamic CMS Core Package

4.8k3.2M720](/packages/statamic-cms)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[currency-cloud/client

A PHP library which implements the complete functionality of v2 of the The Currency Cloud API.

17327.2k](/packages/currency-cloud-client)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

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