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)119MITPHPPHP &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 1mo 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

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

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

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

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[bensampo/laravel-enum

Simple, extensible and powerful enumeration implementation for Laravel.

2.0k15.9M104](/packages/bensampo-laravel-enum)[swaggest/json-schema

High definition PHP structures with JSON-schema based validation

48612.5M73](/packages/swaggest-json-schema)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[ashallendesign/laravel-config-validator

A package for validating your Laravel app's config.

217905.3k5](/packages/ashallendesign-laravel-config-validator)[crazybooot/base64-validation

Laravel validators for base64 encoded files

1341.9M8](/packages/crazybooot-base64-validation)

PHPackages © 2026

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