Download the PHP package siberfx/cloudflare-turnstile without Composer

On this page you can find all versions of the php package siberfx/cloudflare-turnstile. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package cloudflare-turnstile

Cloudflare Turnstile for Laravel

Protect your Laravel forms with Cloudflare Turnstile, the privacy-first CAPTCHA alternative.

Requirements

Package Version
PHP 8.4, 8.5
Laravel 12.x, 13.x

Installation

Add your keys (Cloudflare dashboard → Turnstile → Add widget) to .env:

Optionally publish everything (config, views and translations) with a single command:

Or publish only what you need:

Rendering the widget

Place the component inside your form:

The Cloudflare script is included automatically, only once per page. To load it yourself (e.g. in your <head>), pass :script="false" and use the directive:

Options

Every option maps to a data-* attribute. Defaults come from config('turnstile.widget'):

Validating

Validation rule

The rule is implicit, so a missing token also fails. To check that the token came from a widget with a specific action, use:

Middleware

Safe methods (GET, HEAD, OPTIONS) are skipped. When verification fails, the middleware throws a ValidationException on the cf-turnstile-response field. You get the usual redirect with errors, or a 422 JSON response.

Manual verification

Error handling

Error codes are exposed as the Siberfx\Turnstile\Enums\ErrorCode enum. Next to Cloudflare's own codes, the package adds:

Code Meaning
connection-failed Cloudflare could not be reached (after the retries you configured)
hostname-mismatch Hostname isn't in turnstile.hostnames
action-mismatch Widget action differs from the expected action

Visitors see one of four friendly messages: failed, missing, expired, unavailable. Publish the translations to change them.

ErrorCode::isConfigurationError() helps you tell a wrong secret key apart from a bad visitor.

Configuration

Key Env Default
enabled TURNSTILE_ENABLED true
site_key TURNSTILE_SITE_KEY null
secret_key TURNSTILE_SECRET_KEY null
timeout TURNSTILE_TIMEOUT 5 seconds
retries TURNSTILE_RETRIES 1 (connection errors only)
send_remote_ip TURNSTILE_SEND_REMOTE_IP true
hostnames TURNSTILE_HOSTNAMES [] (comma separated in env)
field cf-turnstile-response
widget.* TURNSTILE_THEME, TURNSTILE_SIZE auto, normal

When enabled is false, every verification passes without a network call. This is useful in local development.

Cloudflare test keys

Site key Behaviour
1x00000000000000000000AA Always passes
2x00000000000000000000AB Always blocks
3x00000000000000000000FF Forces a challenge
Secret key Behaviour
1x0000000000000000000000000000000AA Always passes
2x0000000000000000000000000000000AA Always fails
3x0000000000000000000000000000000AA Yields "token already spent"

Testing your application

Other fake helpers: respondWith(VerificationResult|Closure), assertNotVerified(), assertVerifiedTimes(int), recorded().

Development

License

MIT. See LICENSE.


All versions of cloudflare-turnstile with dependencies

PHP Build Version
Package Version
Requires php Version ~8.4.0|~8.5.0
illuminate/console Version ^12.0|^13.0
illuminate/contracts Version ^12.0|^13.0
illuminate/http Version ^12.0|^13.0
illuminate/support Version ^12.0|^13.0
illuminate/validation Version ^12.0|^13.0
illuminate/view Version ^12.0|^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package siberfx/cloudflare-turnstile contains the following files

Loading the files please wait ...