PHPackages                             fsorge/cloudflare-turnstile-php - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. fsorge/cloudflare-turnstile-php

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

fsorge/cloudflare-turnstile-php
===============================

Validate Cloudflare Turnstile captchas with ease

1.0.0(3y ago)150MITPHPPHP &gt;=8.1

Since Mar 10Pushed 3y ago1 watchersCompare

[ Source](https://github.com/sorge13248/cloudflare-turnstile-php)[ Packagist](https://packagist.org/packages/fsorge/cloudflare-turnstile-php)[ RSS](/packages/fsorge-cloudflare-turnstile-php/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Cloudflare Turnstile
====================

[](#cloudflare-turnstile)

An unofficial PHP package to validate Cloudflare Turnstile captchas with ease. Read more at the [Cloudflare official documentation](https://developers.cloudflare.com/turnstile/).

Requirements
------------

[](#requirements)

- PHP &gt;= 8.1

Getting started
---------------

[](#getting-started)

1. Download this package with Composer

```
composer require fsorge/cloudflare-turnstile-php
```

2. Create a new `Turnstile` instance

```
use Fsorge\Cloudflare\Turnstile;

$turnstile = new Turnstile('YOUR_SECRET_KEY');
```

3. Call the `isValid()` method

```
$isCaptchaValid = $turnstile->isValid('RESPONSE_FROM_CLIENT');
```

4. That's it!

Dictionary
----------

[](#dictionary)

- **YOUR\_SECRET\_KEY**: you can retrieve your secret key by going to your Cloudflare Turnstile dashboard, clicking "Settings" on your website, expanding the "Secret key" section and copying the key somewhere in your project and passing it to the `Turnstile` constructor
- **RESPONSE\_FROM\_CLIENT**: it's a hidden field (with the `name` attribute set to `cf-turnstile-response`) that the Turnstile client-side widget automatically creates in your form. You have to pass that field's value.

Full simple example
-------------------

[](#full-simple-example)

```
use Fsorge\Cloudflare\Turnstile;

$turnstile = new Turnstile('0x......');

$isCaptchaValid = $turnstile->isValid('0.id8uAhu.....');

if ($isCaptchaValid) {
    // Captcha has been validated
} else {
    // Captcha NOT validate
}
```

Detailed response
-----------------

[](#detailed-response)

If you need to have the full response from the Cloudflare Turnstile API, you can call the `validate()` method instead of the `isValid()`.

`validate()` returns an associative array with the whole response from the Cloudflare API, containing useful information like occurred errors if any.

###  Health Score

26

—

LowBetter than 40% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

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

Unknown

Total

1

Last Release

1257d ago

### Community

Maintainers

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

---

Top Contributors

[![sorge13248](https://avatars.githubusercontent.com/u/4579797?v=4)](https://github.com/sorge13248 "sorge13248 (1 commits)")

---

Tags

captchacloudflarephpturnstile

### Embed Badge

![Health badge](/badges/fsorge-cloudflare-turnstile-php/health.svg)

```
[![Health](https://phpackages.com/badges/fsorge-cloudflare-turnstile-php/health.svg)](https://phpackages.com/packages/fsorge-cloudflare-turnstile-php)
```

###  Alternatives

[toplan/laravel-sms

A mobile phone number validation solution based on laravel

83580.2k2](/packages/toplan-laravel-sms)[drupal/coder

Coder is a library to review Drupal code.

3046.8M629](/packages/drupal-coder)[hyperf/validation

hyperf validation

122.2M213](/packages/hyperf-validation)[udokmeci/yii2-phone-validator

Modern Yii2 Phone validator wrapper on top of PhoneNumberUtil library also used by Android devices

36227.5k1](/packages/udokmeci-yii2-phone-validator)[snowcap/vat-validation

EU VAT number validation

10112.3k](/packages/snowcap-vat-validation)

PHPackages © 2026

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