PHPackages                             psecio/canary - 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. psecio/canary

ActiveLibrary[Security](/categories/security)

psecio/canary
=============

An input detection and response library

0.5(6y ago)30122[1 issues](https://github.com/psecio/canary/issues)MITPHP

Since Feb 15Pushed 6y ago3 watchersCompare

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

READMEChangelogDependencies (1)Versions (6)Used By (0)

Canary: Input Detection and Response
====================================

[](#canary-input-detection-and-response)

[![Build Status](https://camo.githubusercontent.com/6fe85cc7ef18d00ccaa6289c9baed9c9c5bf57b85b462d2686dd282d63004421/68747470733a2f2f7472617669732d63692e6f72672f70736563696f2f63616e6172792e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/psecio/canary)

The origin of the term "canary" (as a method of detection) was originally used by those that worked deep in mines and would take a canary (the bird) with them to detect gas or other reasons they needed to leave. If the bird started behaving oddly they knew something was amiss. This same concept is applied in the security world and is similarly called a "canary".

Similarly, the `Canary` library allows you to define key/value combinations that can be used to detect when certain data is used and notify you using a variety of methods including the default PHP error log, log handling via `Monolog` and messages to `Slack` channels.

For example, you may generate a special username that you want to use as a trigger. This username isn't actually a user in your system but you do want to be notified if a login attempt is made using it. `Canary` makes this simple by defining checks with an `if` method and, optionally, a handler using a `then` method. For example, say we generated the username of `canary1234@foo.com` and we want to detect when it's used. You can define this in a `Canary` expression like so:

```
