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%23MITPHPPHP &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 1mo ago

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

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

38

—

LowBetter than 85% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity68

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

685d 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

[symfony/security-bundle

Provides a tight integration of the Security component into the Symfony full-stack framework

2.5k172.9M1.8k](/packages/symfony-security-bundle)[statamic/cms

The Statamic CMS Core Package

4.8k3.2M720](/packages/statamic-cms)[laravel/reverb

Laravel Reverb provides a real-time WebSocket communication backend for Laravel applications.

1.5k9.4M48](/packages/laravel-reverb)[elgg/elgg

Elgg is an award-winning social networking engine, delivering the building blocks that enable businesses, schools, universities and associations to create their own fully-featured social networks and applications.

1.7k15.7k5](/packages/elgg-elgg)[api-platform/http-cache

API Platform HttpCache component

223.2M7](/packages/api-platform-http-cache)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

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