PHPackages                             cloakings/cloakings-common - 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. cloakings/cloakings-common

ActiveLibrary

cloakings/cloakings-common
==========================

Cloakings common library

1.5.0(1y ago)33.3k↑146.6%2MITPHPPHP &gt;=8.3

Since Oct 2Pushed 1y ago1 watchersCompare

[ Source](https://github.com/cloakings/cloakings-common)[ Packagist](https://packagist.org/packages/cloakings/cloakings-common)[ RSS](/packages/cloakings-cloakings-common/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (2)Versions (12)Used By (0)

Cloakings Common Library
========================

[](#cloakings-common-library)

Detect if user is bot or real user.

Install
-------

[](#install)

```
composer require cloakings/cloakings-common
```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

If there is library that fits your needs and implements `CloakerInterface` - use it.

```
use Cloakings\CloakingsCommon\CloakerFactory;
use Cloakings\CloakingsCommon\CloakModeEnum;
use Cloakings\CloakingsCommon\SampleCloaker;

$cloaker = new SampleCloaker();
// or
$cloaker = (new CloakerFactory())->create(SampleCloaker::class);

$result = $cloaker->handle(new Request(server: ['HTTP_USER_AGENT' => 'Chrome 100']));
// $result->mode === CloakModeEnum::Real
// show real site

$result = $cloaker->handle(new Request(server: ['HTTP_USER_AGENT' => 'GoogleBot', 'REMOTE_ADDR' => '8.8.8.8']));
// $result->mode === CloakModeEnum::Fake
// show fake site

$result = $cloaker->handle(new Request(server: ['HTTP_USER_AGENT' => 'GoogleBot', 'REMOTE_ADDR' => '11.22.33.44']));
// $result->mode === CloakModeEnum::Response
// stop and show this response

$result = $cloaker->handle(new Request()); // no user agent
// $result->mode === CloakModeEnum::Error
// decide by yourself: may be show default (fake or real) site, may be try chaining decision to another cloaker
```

### Chaining

[](#chaining)

If you want visitor to pass several cloakers then use `ChainCloaker`

```
use Cloakings\CloakingsCommon\AlwaysRealCloaker;
use Cloakings\CloakingsCommon\CloakerFactory;
use Cloakings\CloakingsCommon\SampleCloaker;

$cloaker = (new CloakerFactory())->createChain([
    AlwaysRealCloaker::class,
    SampleCloaker::class,
]);
```

Logic:

- if cloaker tells "Fake" - stop and return "Fake"
- if cloaker tells "Response" - stop and return "Response"
- if cloaker tells "Real" - continue to the next cloaker; return last "Real" response
- if cloaker tells "Error" - continue to the next cloaker; return last "Real" response; if all cloakers return "Error" then return last "Error"

Create own Cloaker
------------------

[](#create-own-cloaker)

Implement `CloakerInterface`.

Return `mode`:

- "Real": it seems that visitor is real human user
- "Fake": it seems that visitor is bot user
- "Response": don't show fake or real site but this response: usually temp pages for additional checks like captcha or js challenge
- "Error": cannot decide

Return `response`: used only in mode "Response" or "Error"

Return `probability`: how sure you are `0.0 - 1.0`. Useful if you have several cloakers and one says "Real", another says "Fake" and you want to decide. Usually just keep default `1.0`.

###  Health Score

37

—

LowBetter than 84% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity67

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

Recently: every ~142 days

Total

11

Last Release

635d ago

PHP version history (2 changes)1.0PHP &gt;=8.1

1.5.0PHP &gt;=8.3

### Community

Maintainers

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

---

Top Contributors

[![luchaninov](https://avatars.githubusercontent.com/u/3829796?v=4)](https://github.com/luchaninov "luchaninov (11 commits)")

---

Tags

blackhatcloakingphpphp-librarytraffictraffic-analysis

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/cloakings-cloakings-common/health.svg)

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

###  Alternatives

[bugsnag/bugsnag-symfony

Official BugSnag notifier for Symfony applications.

452.9M3](/packages/bugsnag-bugsnag-symfony)

PHPackages © 2026

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