PHPackages                             cleantalk/php-antispam - 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. cleantalk/php-antispam

ActiveLibrary[API Development](/categories/api)

cleantalk/php-antispam
======================

PHP API for antispam service cleantalk.org. Invisible protection from spam, no captches, no puzzles, no animals and no math.

4.3(5mo ago)70600.8k—2.2%332GPL-3.0PHPCI failing

Since May 18Pushed 1mo ago16 watchersCompare

[ Source](https://github.com/CleanTalk/php-antispam)[ Packagist](https://packagist.org/packages/cleantalk/php-antispam)[ Docs](http://cleantalk.org)[ RSS](/packages/cleantalk-php-antispam/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (18)Used By (2)

CleanTalk php-antispam: Lightweight Spam Protection for PHP Apps
================================================================

[](#cleantalk-php-antispam-lightweight-spam-protection-for-php-apps)

============

[![example workflow](https://github.com/CleanTalk/php-antispam/actions/workflows/tests.yml/badge.svg)](https://github.com/CleanTalk/php-antispam/actions/workflows/tests.yml/badge.svg)

[![Latest Stable Version](https://camo.githubusercontent.com/53de1fd9bc9b02e12e454ab586ab5854ba28db6eeeae6646fc69894993cefadf/68747470733a2f2f706f7365722e707567782e6f72672f636c65616e74616c6b2f7068702d616e74697370616d2f76)](https://packagist.org/packages/cleantalk/php-antispam)

The Invisible protection from spam, no captcha, no recaptcha, no puzzles, no math captcha.
------------------------------------------------------------------------------------------

[](#the-invisible-protection-from-spam-no-captcha-no-recaptcha-no-puzzles-no-math-captcha)

*API for antispam service cleantalk.org*

#### Requirements

[](#requirements)

- PHP 5.6 and above
- CURL support

### How we stop spam?

[](#how-we-stop-spam)

PHP Anti-Spam library providing invisible spam protection for your websites, registration forms, and comment sections. CleanTalk API offers an effective CAPTCHA alternative that silently blocks spam without interrupting your users' experience.

When users submit forms on your website form, the form data is securely sent to CleanTalk’s cloud servers. CleanTalk analyzes submissions using advanced heuristics. CleanTalk then returns a real-time verdict— legitimate requests or spam.

You are free to do anything with spam, or just allow as to block spam (we will interrupt desirable request).

CleanTalk vs CAPTCHA
--------------------

[](#cleantalk-vs-captcha)

FeatureCleanTalk Anti-SpamTraditional CAPTCHAUser Interaction100% invisible to usersRequires solving puzzles or clicksForm CompatibilityWorks with any PHP formOften requires additional scriptsSpeedInstant cloud checkSlower due to user interactionAccessibilityFully accessible, no visual testsOften inaccessible to screen readers> CleanTalk is a **PHP spam filter** and a **captcha-free alternative** that boosts UX and protects your forms with zero friction.

Interesting? Let's make some settings (it will take few minutes)
----------------------------------------------------------------

[](#interesting-lets-make-some-settings-it-will-take-few-minutes)

### Step 1 - install our SDK (2 variants ability)

[](#step-1---install-our-sdk-2-variants-ability)

Through composer install **OR** through download zip arhive and unzip it to root directory (with your index.php)

```
composer require cleantalk/php-antispam
```

### Step 2 - add CleantalkAntispam handler (middleware/interception) to your form handler (action)

[](#step-2---add-cleantalkantispam-handler-middlewareinterception-to-your-form-handler-action)

```
$apikey = ''; // get it here cleantalk.org (free trial)
$email_field = $_POST['email']; // get it from your form
$cleantalk_antispam = new CleantalkAntispam($apikey, $email_field);
// Additional parameters here
$api_result = $cleantalk_antispam->handle();
```

### Step 2.1 - add js lib to your html template

[](#step-21---add-js-lib-to-your-html-template)

*Need for gathering frontend data.*

```

```

and do not forget to add additional parameter to the request

```
...
// Additional parameters here
$cleantalk_antispam->setEventTokenEnabled(1);
...
```

### Step 3 - do whatever you want with cloud result

[](#step-3---do-whatever-you-want-with-cloud-result)

For example add die block for spam.

```
if ($api_result && $api_result->allow === 0) {
    die('Blocked. Spam protection OK. Reason: ' . $api_result->comment);
    // or make your own actions/logs/messages ...
}
```

### Step 4 (not required) - we prepare for you special troubleshooting method

[](#step-4-not-required---we-prepare-for-you-special-troubleshooting-method)

To find possible problems, just add follow snippet after getVerdict method.

```
// TROUBLESHOOTING: logging the suggestions
error_log($cleantalk_antispam->whatsWrong(true));
```

In [example file](https://github.com/CleanTalk/php-antispam/blob/dev/examples/form_with_handler/form_with_handler.php) you can see context.

### Step 5 (not required) - if you have any question, please, feel free to ask it in issue here or in our tiket system

[](#step-5-not-required---if-you-have-any-question-please-feel-free-to-ask-it-in-issue-here-or-in-our-tiket-system)

Examples
--------

[](#examples)

- [api response description](https://github.com/CleanTalk/php-antispam/tree/dev/examples/api_response_description.md)
- [example with form handler](https://github.com/CleanTalk/php-antispam/blob/dev/examples/form_with_handler/form_with_handler.php)

Don't want to deal with all this?
---------------------------------

[](#dont-want-to-deal-with-all-this)

Universal solution for any CMS or custom website:

### Websites that trust CleanTalk!

[](#websites-that-trust-cleantalk)

[![CleanTalk Anti-Spam Rating](https://camo.githubusercontent.com/843a75b91b5196d88d81383a0aad9cc9ecc14010dce1e8f15aa7016678998cca/68747470733a2f2f636c65616e74616c6b2e6f72672f7765627061636b2f696d672f636c65616e74616c6b5f726174696e672e706e67)](https://camo.githubusercontent.com/843a75b91b5196d88d81383a0aad9cc9ecc14010dce1e8f15aa7016678998cca/68747470733a2f2f636c65616e74616c6b2e6f72672f7765627061636b2f696d672f636c65616e74616c6b5f726174696e672e706e67)

CleanTalk as [reCAPTCHA alternative](https://cleantalk.org/recaptcha-alternative).

###  Health Score

62

—

FairBetter than 99% of packages

Maintenance82

Actively maintained with recent releases

Popularity51

Moderate usage in the ecosystem

Community31

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor3

3 contributors hold 50%+ of commits

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

Recently: every ~83 days

Total

16

Last Release

153d ago

Major Versions

2.6 → 3.02023-04-27

3.2 → 4.02025-07-07

### Community

Maintainers

![](https://www.gravatar.com/avatar/00cabd14ad0a24b6614de589e72519ff4433864097687217e62c2d80a10338ee?d=identicon)[CleanTalk](/maintainers/CleanTalk)

---

Top Contributors

[![shagimuratov](https://avatars.githubusercontent.com/u/1734482?v=4)](https://github.com/shagimuratov "shagimuratov (36 commits)")[![VladCleantalk](https://avatars.githubusercontent.com/u/11616143?v=4)](https://github.com/VladCleantalk "VladCleantalk (20 commits)")[![alexandergull](https://avatars.githubusercontent.com/u/45482252?v=4)](https://github.com/alexandergull "alexandergull (16 commits)")[![Glomberg](https://avatars.githubusercontent.com/u/8588152?v=4)](https://github.com/Glomberg "Glomberg (15 commits)")[![safronik](https://avatars.githubusercontent.com/u/16255344?v=4)](https://github.com/safronik "safronik (13 commits)")[![svfcode](https://avatars.githubusercontent.com/u/74239490?v=4)](https://github.com/svfcode "svfcode (10 commits)")[![psrustik](https://avatars.githubusercontent.com/u/804867?v=4)](https://github.com/psrustik "psrustik (5 commits)")[![AntonV1211](https://avatars.githubusercontent.com/u/39616556?v=4)](https://github.com/AntonV1211 "AntonV1211 (5 commits)")[![znaeff](https://avatars.githubusercontent.com/u/5362213?v=4)](https://github.com/znaeff "znaeff (4 commits)")[![ArtemAnoshin](https://avatars.githubusercontent.com/u/36857361?v=4)](https://github.com/ArtemAnoshin "ArtemAnoshin (3 commits)")[![venera81](https://avatars.githubusercontent.com/u/220177689?v=4)](https://github.com/venera81 "venera81 (2 commits)")[![dada-amater](https://avatars.githubusercontent.com/u/3747040?v=4)](https://github.com/dada-amater "dada-amater (1 commits)")[![BrookeDot](https://avatars.githubusercontent.com/u/150348?v=4)](https://github.com/BrookeDot "BrookeDot (1 commits)")[![bechir](https://avatars.githubusercontent.com/u/13308700?v=4)](https://github.com/bechir "bechir (1 commits)")[![jimwins](https://avatars.githubusercontent.com/u/329264?v=4)](https://github.com/jimwins "jimwins (1 commits)")[![ardavydov](https://avatars.githubusercontent.com/u/28943774?v=4)](https://github.com/ardavydov "ardavydov (1 commits)")[![goodot](https://avatars.githubusercontent.com/u/10999902?v=4)](https://github.com/goodot "goodot (1 commits)")

---

Tags

antispamform-protectionphpphp-apispamspam-filterspam-protectionapispamantispamanti-spam

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/cleantalk-php-antispam/health.svg)

```
[![Health](https://phpackages.com/badges/cleantalk-php-antispam/health.svg)](https://phpackages.com/packages/cleantalk-php-antispam)
```

###  Alternatives

[helgesverre/spamprotection

A Spam Protection class for use in contact forms and comment fields, uses the StopForumSpam API.

2429.9k](/packages/helgesverre-spamprotection)[m165437/laravel-blueprint-docs

API Blueprint Renderer for Laravel

22779.0k](/packages/m165437-laravel-blueprint-docs)[omines/akismet

Open source library for using the Wordpress Akismet anti spam service

114.8k](/packages/omines-akismet)

PHPackages © 2026

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