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

ActiveLibrary[API Development](/categories/api)

cobwebinfo/shrek-api-client
===========================

The client for Cobweb information's SHREK API.

1.2.1(9y ago)0251MITPHPPHP &gt;=5.5

Since Oct 10Pushed 7y ago5 watchersCompare

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

READMEChangelog (3)Dependencies (5)Versions (9)Used By (0)

S.H.R.E.K API Client
====================

[](#shrek-api-client)

[![Build Status](https://camo.githubusercontent.com/ab0769be3b1b5c5b8d611e2940b4c05be393aecffb4f4f815dc073963da718cf/68747470733a2f2f7472617669732d63692e6f72672f636f62776562696e666f2f736872656b2d6170692d636c69656e742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/cobwebinfo/shrek-api-client)

[![Codacy Badge](https://camo.githubusercontent.com/eb02855c815c1c79a3db1278bfb87b049bf1d3a00b0982ce93d399d0c774ba79/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3630626239636561373231643433343761343863656433363063666635646639)](https://www.codacy.com/app/jr-cobweb/shrek-api-client?utm_source=github.com&utm_medium=referral&utm_content=cobwebinfo/shrek-api-client&utm_campaign=Badge_Grade)

This library can be used to pull data from the various public endpoints provided by the SHREK API. The client has been created with ease of use in mind, simply provide your API ID and private key and use the instructions below to proceed.

\##Compatibility

Client VersionPHP Version1.0.\*5.3 - 5.41.2.\*5.5+Installation
------------

[](#installation)

The suggested installation method is via [composer](https://getcomposer.org/):

```
php composer.phar require "cobwebinfo/shrek-api-client:1.2.*"
```

Requesting access to the API.
-----------------------------

[](#requesting-access-to-the-api)

Please contact Cobwebinfo at @  to access an API key.

Usage
-----

[](#usage)

The ShrekServiceProvider class provides a neat wrapper for instantiating the various clients needed to access the API. You can manually instantiate the clients if you do not wish to use it, however.

You can get an instance as follows:

```
$provider = new \Cobwebinfo\ShrekApiClient\ShrekServiceProvider([
                'client_id' => YOUR ID,
                'client_secret'=> YOUR SECRET
]);
```

I would suggest adding this as a singleton to your service container. If you use Laravel for example, you could do the following:

```
$this->app->singleton(\Cobwebinfo\ShrekApiClient\ShrekServiceProvider::class, function() {
            return new \Cobwebinfo\ShrekApiClient\ShrekServiceProvider([
                'client_id' => YOUR ID,
                'client_secret'=> YOUR SECRET
            ]);
        });
```

The array passed to the provider is used for configuration. To see the available options, refer to the [Config.yaml file](src/Cobwebinfo/ShrekApiClient/config.yaml).

**Once you have a provider instance, you can access the various clients as follows:**

```
$keywordClient = $provider->getKeywordClient();
```

You can then access data from the API as follows:

```
  try {
        $response = $keywordClient->paginate(1, 4, []);
    } catch(IdentityProviderException $e) {
        var_dump('Authentication error: ' . $e->getMessage());
    }

    if($response->wasSuccessful()) {
        foreach($response->body['data']['items'] as $key => $keyword) {
            echo " $key ";

            var_dump($keyword);
        }
    }
```

#### Caching

[](#caching)

**Please note:** By default the app uses the 'NullStore' cache class. This is an implementation of the null object pattern, and as you may have guessed does not cache anything. If you intend to use this method, you will need to implement your own caching to avoid hitting API limits. Alternatively, if your application supports APC or memcache, you can use one of the inbuilt classes to handle caching automatically. To do so, use the config below:

```
$provider = new \Cobwebinfo\ShrekApiClient\ShrekServiceProvider([
                'client_id' => YOUR ID,
                'client_secret'=> YOUR SECRET,
                'cache_driver' => 'memcache' OR 'apc'
]);
```

If you wish to roll your own cache implementation then create a new class which uses the 'Cobwebinfo\\ShrekApiClient\\Cache\\Contracts\\Store' interface and pass the fully qualified name into the Provider, as follows:

```
$provider = new \Cobwebinfo\ShrekApiClient\ShrekServiceProvider([
                'client_id' => YOUR ID,
                'client_secret'=> YOUR SECRET,
                'cache_driver' => '\Your\Namespace\ClassName'
]);
```

#### Http Clients

[](#http-clients)

By default Guzzle is used as the HTTP client. If you prefer not to use guzzle, then an alternative implementation is provided. To use this, provide the following config:

```
$provider = new \Cobwebinfo\ShrekApiClient\ShrekServiceProvider([
                'client_id' => YOUR ID,
                'client_secret'=> YOUR SECRET,
                'http_client' => 'asika'
]);
```

As with caching, you can also roll your own HTTP client should you so choose. Simply create a new class implementing the 'Cobwebinfo\\ShrekApiClient\\Support\\HttpRequester' interface and pass in the full qualified name, as follows:

**Please note:** The class should return a '\\Psr\\Http\\Message\\ResponseInterface' instance.

```
$provider = new \Cobwebinfo\ShrekApiClient\ShrekServiceProvider([
                'client_id' => YOUR ID,
                'client_secret'=> YOUR SECRET,
                'http_client' => '\Your\Namespace\ClassName'
]);
```

#### Config

[](#config)

The package provides a Yaml reader sħould you want to store your client id, client secret or other config in a yaml file. It works as follows:

```
Yaml::parse(file_get_contents(__DIR__ . '/config.yaml'));;
```

The above would return an associative array, which you could then pass into the ShrekServiceProvider.

Todo
----

[](#todo)

- Clear/bypass cache?
- Packagist

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community11

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 ~0 days

Total

8

Last Release

3494d ago

PHP version history (2 changes)1.0.0PHP &gt;=5.3,&lt;8.0-DEV

v1.2.0.x-devPHP &gt;=5.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/73fea64422b09479ce931d520d58752180aa518c92e1e2af2c66a623780b3aad?d=identicon)[pbcobweb](/maintainers/pbcobweb)

![](https://www.gravatar.com/avatar/91a9ca6b12f4a5a0319ff9e03fa4a954d543599a23d2688dccd34d6f1cac462d?d=identicon)[jr-cobweb](/maintainers/jr-cobweb)

---

Top Contributors

[![jr-cobweb](https://avatars.githubusercontent.com/u/10956640?v=4)](https://github.com/jr-cobweb "jr-cobweb (45 commits)")

### Embed Badge

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

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

###  Alternatives

[sylius/sylius

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

8.4k5.6M648](/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)[tempest/framework

The PHP framework that gets out of your way.

2.1k23.1k9](/packages/tempest-framework)[dcblogdev/laravel-microsoft-graph

A Laravel Microsoft Graph API (Office365) package

168285.5k1](/packages/dcblogdev-laravel-microsoft-graph)[dcblogdev/laravel-xero

A Laravel Xero package

53129.1k1](/packages/dcblogdev-laravel-xero)

PHPackages © 2026

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