PHPackages                             koko/koko-keywords - 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. koko/koko-keywords

ActiveLibrary[API Development](/categories/api)

koko/koko-keywords
==================

A PHP client for the Koko Keywords API

0.3.2(3y ago)215MITPHPPHP &gt;= 7.4

Since Jun 16Pushed 3y agoCompare

[ Source](https://github.com/kokocares/keywords-client-php)[ Packagist](https://packagist.org/packages/koko/koko-keywords)[ RSS](/packages/koko-koko-keywords/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (4)Used By (0)

Koko Keyword PHP Client
=======================

[](#koko-keyword-php-client)

A php client for the [Koko Keywords API](https://developers.kokocares.org). The client handles caching to ensure very low latency.

Install
-------

[](#install)

### Ensure that php ffi module is installed

[](#ensure-that-php-ffi-module-is-installed)

In php.ini make the extention is enabled:

```
extension=ffi

```

### Install php module

[](#install-php-module)

Install the module

```
composer require koko/koko-keywords

```

Usage
-----

[](#usage)

Set the `KOKO_KEYWORDS_AUTH` environment to the authentication string provided by Koko. To get an api key, complete our [sign up form](https://r.kokocares.org/api_signup).

```
export KOKO_KEYWORDS_AUTH=username:password

```

Import the module

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

use Koko\Keywords;

$koko_keywords = new Keywords();
```

You may need to set the environment variable in PHP depending on your setup:

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

putenv("KOKO_KEYWORDS_AUTH=username:password")
use Koko\Keywords;

$koko_keywords = new Keywords();
```

It's recommended to instantiate this once to minimize the overhead of loading the library.

Then use the `match` function to check whether a query prompt matches a risky keyword. The function returns a `bool` indicating whether there was a match or not. The function will raise an exception if there is an issue.

```
if ($koko_keywords->match("some value", "") {
  // Code if there is a match
}
```

There is one optional params, `filter`, set it to the empty string if you are not using it.

### Filter

[](#filter)

Filter the keyword based on the taxonomy using a colon delimited list of “dimension=value” filters. Omitting a dimension does not filter by that dimension e.g.

```
$koko_keywords->match("sewerslide", "category=eating,parenting:confidence=1,2")
```

This matches "sewerslide" against eating eating and parenting, with a confidence of 1 and 2 and any intensity (as intensity was omitted).

Performance
-----------

[](#performance)

The underlying library is written in Rust and cross-compiled to the four major CPU targets. Regexes are cached based on the cache expiration headers (currently set to an hour). This ensures very low latency and overhead (&lt; 1μs/req).

Error Handling
--------------

[](#error-handling)

The `match` function raises an exception if there is an issue.

Logging
-------

[](#logging)

Minimal log messages are logged to STDERR

License
-------

[](#license)

```
WWWWWW||WWWWWW
 W W W||W W W
      ||
    ( OO )__________
     /  |           \
    /o o|    MIT     \
    \___/||_||__||_|| *
         || ||  || ||
        _||_|| _||_||
       (__|__|(__|__|

```

(The MIT License)

Copyright (c) 2017 Koko AI Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

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

Total

3

Last Release

1251d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d025caa50fc05794f099591bd115cb8c8eaac689bb8969ff6d91e6060f11147f?d=identicon)[kareemk](/maintainers/kareemk)

---

Top Contributors

[![kareemk](https://avatars.githubusercontent.com/u/65574?v=4)](https://github.com/kareemk "kareemk (10 commits)")

### Embed Badge

![Health badge](/badges/koko-koko-keywords/health.svg)

```
[![Health](https://phpackages.com/badges/koko-koko-keywords/health.svg)](https://phpackages.com/packages/koko-koko-keywords)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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