PHPackages                             devtoolboxuk/cerberus - 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. [Security](/categories/security)
4. /
5. devtoolboxuk/cerberus

ActiveLibrary[Security](/categories/security)

devtoolboxuk/cerberus
=====================

Another Security Package for PHP

0.0.2(6y ago)06MITPHPPHP &gt;=5.4.16

Since May 26Pushed 6y ago1 watchersCompare

[ Source](https://github.com/devtoolboxuk/cerberus)[ Packagist](https://packagist.org/packages/devtoolboxuk/cerberus)[ RSS](/packages/devtoolboxuk-cerberus/feed)WikiDiscussions master Synced 3d ago

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

Cerberus
========

[](#cerberus)

[![Build Status](https://camo.githubusercontent.com/c74d30b1adfa5f957ad242b95e650b2f8b2441277c3091707474c2270035ca5e/68747470733a2f2f6170692e7472617669732d63692e6f72672f646576746f6f6c626f78756b2f63657262657275732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/devtoolboxuk/cerberus)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/87f7ed190f23fb0e2e4e6fa015b5cd4eca38dacc2a781178ebc21b0f1c9229b6/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f646576746f6f6c626f78756b2f63657262657275732f6d61737465722e7376673f7374796c653d666c6174)](https://scrutinizer-ci.com/g/devtoolboxuk/cerberus/?branch=master)[![Coveralls](https://camo.githubusercontent.com/2ec2a6c0bfe5a63caca6134b07331e6524e55b767122fd3d8e3aedab02d330af/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f646576746f6f6c626f78756b2f63657262657275732f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/devtoolboxuk/cerberus?branch=master)[![CodeCov](https://camo.githubusercontent.com/1084d234aac21ae9a9bbda8657d1f28cccde93417e8db97f9b19f41e145893c6/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f646576746f6f6c626f78756b2f63657262657275732e7376673f7374796c653d666c6174266c6f676f3d636f6465636f76)](https://codecov.io/gh/devtoolboxuk/cerberus)

[![Latest Stable Version](https://camo.githubusercontent.com/5fb785eeb90ae58bd4511b6e5dc89236c50a5538fccc1b9559d45bac4f0beb08/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f646576746f6f6c626f78756b2f63657262657275732e7376673f7374796c653d666c6174)](https://packagist.org/packages/devtoolboxuk/cerberus)[![Total Downloads](https://camo.githubusercontent.com/db122bfd06d9953dccd86da9158383a62f086959bd16ca537ee2d7a93499862d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f646576746f6f6c626f78756b2f63657262657275732e7376673f7374796c653d666c6174)](https://packagist.org/packages/devtoolboxuk/cerberus)[![License](https://camo.githubusercontent.com/b34d677d3154a28b3935e67f42d5e0fa622ed8ce77a79341c6c7fdcbd7c3103b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f646576746f6f6c626f78756b2f63657262657275732e7376673f7374796c653d666c6174)](https://packagist.org/packages/devtoolboxuk/cerberus)

[![Maintenance](https://camo.githubusercontent.com/39f05f24c97b4ef8eed543a7e7692dae64aea459f9befd3820c81c74fea45c2c/68747470733a2f2f696d672e736869656c64732e696f2f6d61696e74656e616e63652f7965732f323031392e7376673f7374796c653d666c6174)](https://github.com/DevToolBoxUk)

[![PHP](https://camo.githubusercontent.com/e5f562fd1c08d31c9d3127aae520cf189c5ed55da04765a1adcd7a45da6fbc17/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f646576746f6f6c626f78756b2f63657262657275732f6465762d6d61737465722e7376673f7374796c653d706c6173746963)](https://github.com/DevToolBoxUk)

Table of Contents
-----------------

[](#table-of-contents)

- [Background](#Background)
- [Usage](#Usage)
- \[Help Support This Project\](#Help Support This Project)
- [Maintainers](#Maintainers)
- [License](#License)

Background
----------

[](#background)

Detects if various threats are placed against the system. A score is then given to each threat. You can then decide what you want to action based on that score.

Features
--------

[](#features)

- Detects if any threats are in the string.
- Gives a score to any threats found.
- Cleans the string of any threats.

Usage
-----

[](#usage)

```
$ composer require devtoolboxuk/cerberus
```

Then include Composer's generated vendor/autoload.php to enable autoloading:

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

```
use devtoolboxuk\cerberus;

$this->cerberus = new Cerberus();
```

#### Set Options

[](#set-options)

```
$cerberus->setOptions($this->getOptions());
```

Example - Detection of a dodgy website registration
---------------------------------------------------

[](#example---detection-of-a-dodgy-website-registration)

Also see tests/test-registration.php

```
function testDodgyRegistration()
{

    $cerberus = new CerberusService();
    $cerberus->setOptions($this->getOptions());

    $login_array = [
        'email' => 'rob@shotmail.ru',
        'name' => 'Visit my website http://www.doajob.org?redirect=https://www.google.com',
        'address' => 'Some Street',
        'postcode' => 'GL1 1AA',
        'country' => 'MX',
    ];

    $detection = $cerberus
        ->resetHandlers()
        ->pushHandler($this->createLoginStringHandler('Name', $login_array['name']))
        ->pushHandler($this->createLoginStringHandler('Address', $login_array['address']))
        ->pushHandler(new EmailHandler($login_array['email']))
        ->pushHandler(new CountryHandler($login_array['country']));

    $detection->getScore(); //Returns a Score
    $detection->getOutputByName('Name'); //Returns the cleaned sanitised output of Name;
    $detection->getResult(); //Returns a result

}

private function createLoginStringHandler($name, $data)
{
    $handler = new DefaultHandler($name, $data);
    $handler->pushWrapper(new HtmlWrapper());
    $handler->pushWrapper(new UrlWrapper());
    $handler->pushWrapper(new XssWrapper());
    return $handler;
}
```

### Get References

[](#get-references)

Get Input for each reference
----------------------------

[](#get-input-for-each-reference)

```
foreach ($detection->getReferences() as $reference)
{
    $reference->getInput();
}
```

Get Output for each reference
-----------------------------

[](#get-output-for-each-reference)

```
foreach ($detection->getReferences() as $reference)
{
    $reference->getOutPut();
}
```

Get Output by name assigned
---------------------------

[](#get-output-by-name-assigned)

- If a name is not assigned, you wont be able to look it up... duh

```
$detection->getOutputByName('Name');
# eg: 'Visit my website'
```

Help Support This Project
-------------------------

[](#help-support-this-project)

[![Help Support This Project](https://raw.githubusercontent.com/devtoolboxuk/cerberus/master/assets/buy-me-a-coffee-button.png)](https://Ko-fi.com/devtoolboxuk)

Maintainers
-----------

[](#maintainers)

[@DevToolboxUk](https://github.com/DevToolBoxUk).

License
-------

[](#license)

[MIT](LICENSE) © DevToolboxUK

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

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

Total

2

Last Release

2519d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/11e7828108a460ad0b3dc92c08fa9e0e863168b8dae2b4d7041a6d699f936faa?d=identicon)[devtoolboxuk](/maintainers/devtoolboxuk)

---

Top Contributors

[![devtoolboxuk](https://avatars.githubusercontent.com/u/6337609?v=4)](https://github.com/devtoolboxuk "devtoolboxuk (39 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/devtoolboxuk-cerberus/health.svg)

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

###  Alternatives

[defuse/php-encryption

Secure PHP Encryption Library

3.9k162.4M214](/packages/defuse-php-encryption)[roave/security-advisories

Prevents installation of composer packages with known security vulnerabilities: no API, simply require it

2.9k97.3M6.4k](/packages/roave-security-advisories)[mews/purifier

Laravel 5/6/7/8/9/10 HtmlPurifier Package

2.0k16.7M113](/packages/mews-purifier)[robrichards/xmlseclibs

A PHP library for XML Security

41278.1M118](/packages/robrichards-xmlseclibs)[bjeavons/zxcvbn-php

Realistic password strength estimation PHP library based on Zxcvbn JS

86917.5M63](/packages/bjeavons-zxcvbn-php)[illuminate/encryption

The Illuminate Encryption package.

9229.7M280](/packages/illuminate-encryption)

PHPackages © 2026

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