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.

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 turnstile

Turnstile PHP client library

PHP Version Latest Version Total Downloads GitHub CI

Inspired on recaptcha

Table of contents

  1. Installation
  2. Getting started
  3. 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

PHP Build Version
Package Version
Requires php Version ^8.1
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
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 usarise/turnstile contains the following files

Loading the files please wait ....