Download the PHP package usarise/turnstile without Composer
On this page you can find all versions of the php package usarise/turnstile. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download usarise/turnstile
More information about usarise/turnstile
Files in usarise/turnstile
Package turnstile
Short Description PHP library for Turnstile, is Cloudflare’s smart CAPTCHA alternative. It can be embedded into any website without sending traffic through Cloudflare and works without showing visitors a CAPTCHA.
License Unlicense
Informations about the package turnstile
Turnstile PHP client library
Inspired on recaptcha
Table of contents
- Installation
- Getting started
- Usage
- Turnstile
- Client
- Examples http clients
- Guzzle http client
- Symfony http client and Nyholm PSR-7
- Symfony http client and Guzzle PSR-7
- Symfony http client and Guzzle PSR-7 and Discovery
- Curl http client and Nyholm PSR-7
- Discovery http client
- secret key
- idempotency key
- verify
- response
- error codes to description
Installation
Getting started
Installation symfony http client and nyholm psr7 and usarise turnstile
TurnstileExample.php
Response to string
Response to array
Response object to array
Usage Turnstile
Construct
Simplified construct
PSR-18 Clients like php-http/discovery
Usage Client
Construct
Examples http clients
Guzzle http client
Installation
Usage
Symfony http client and Nyholm PSR-7
Installation symfony http client and nyholm psr7
Usage
Simplified construct
Symfony http client and Guzzle PSR-7
Installation symfony http client and guzzlehttp psr7
Usage
Simplified construct
Symfony http client and Guzzle PSR-7 and Discovery
Installation symfony http client and guzzlehttp psr7 and php http discovery
Usage
Simplified construct
Curl http client and Nyholm PSR-7
Installation nyholm psr7 and php http curl client
Usage
Discovery http client
Installation php http discovery
Usage
Simplified construct
Usage secret key
The widget’s secret key. The secret key can be found under widget settings in the Cloudflare dashboard under Turnstile.
Real keys
API keys at https://dash.cloudflare.com/?to=/:account/turnstile
Test keys
1x0000000000000000000000000000000AA
Always passes
2x0000000000000000000000000000000AA
Always fails
3x0000000000000000000000000000000AA
Yields a “token already spent” error
Example
Usage idempotency key
If an application requires to retry failed requests, it must utilize the idempotency functionality.
You can do so by providing a UUID as the idempotencyKey
parameter and then use $turnstile->verify(...)
with the same token the required number of times.
Example with Ramsey UUID
Installation
Usage
Usage verify
Sample
Remote IP
The remoteIp
parameter helps to prevent abuse by ensuring the current visitor is the one who received the token.
This is currently not strictly validated.
Basic usage
With usage CloudFlare
Extended
Usage response
Success status
Error codes
Challenge timestamp
Hostname
Action
Customer data
To string
String with raw json data
To array
Decoded json data
Object to array
Array of processed json data based on properties of Response
class:
success
, errorCodes
, challengeTs
, hostname
, action
, cdata
Usage error codes to description
Convert error codes to a description in a suitable language (default english)
All versions of turnstile with dependencies
ext-json Version *
psr/http-client Version ^1.0
psr/http-client-implementation Version ^1.0
psr/http-factory Version ^1.0
psr/http-factory-implementation Version ^1.0