Download the PHP package particle-academy/fancy-captcha without Composer

On this page you can find all versions of the php package particle-academy/fancy-captcha. 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 fancy-captcha

fancy-captcha

Bot protection for Laravel 13 forms. One Verifier contract, four drivers:

driver what it checks third party
builtin (default) a honeypot, a signed form-render time (3 seconds to 6 hours), and optionally a single-use SHA-256 proof-of-work none, no keys, no network
turnstile Cloudflare Turnstile siteverify, plus hostname and action Cloudflare
recaptcha Google reCAPTCHA v2 (checkbox) or v3 (score threshold and expected action) Google
hcaptcha hCaptcha siteverify, plus hostname (and an optional enterprise risk score) hCaptcha

Providers are called over plain HTTP with Laravel's HTTP client. There are no SDKs.

The UI is @particle-academy/fancy-captcha-ui on npm: one React component for every driver.

Protect a form

The middleware verifies a POST before your controller runs:

Or as a validation rule, in a form request:

Both throw a validation error under the captcha key (fancy-captcha.error_key) with one generic message: "We could not verify this submission. Please reload the page and try again." The specific reason (too_fast, honeypot_filled, pow_replayed, provider_unreachable, ...) goes to the log only. Telling a bot which check it tripped teaches it.

Using both on the same request is safe: the verdict is remembered on the request, so a proof-of-work is redeemed once.

Anywhere else: Captcha::verify($request, 'signup')->passed.

Give the UI its props

With Inertia installed, every page gets a fancyCaptcha prop automatically, with a fresh signed timestamp per render. Without Inertia, pass Captcha::props() to your view yourself.

The field names are constants on both sides (FancyCaptcha\Fields here, CAPTCHA_FIELDS in the UI). Rename them in fancy-captcha.fields and the UI follows, because it reads the names from the props.

The built-in checks

What it does not do, honestly: a determined attacker with a real browser, or native code for the proof-of-work, gets through the built-in checks. They stop the cheap, high-volume bots (random names, dotted-gmail sign-ups). For the rest, add a provider.

The challenge route is throttled per IP (routes.per_minute, 30).

Providers

RECAPTCHA_SITE_KEY / RECAPTCHA_SECRET_KEY / RECAPTCHA_VERSION=v3 and HCAPTCHA_SITE_KEY / HCAPTCHA_SECRET_KEY work the same way.

Fails closed. With both keys set, anything short of a well-formed "success": true is a refusal: a connection error, a timeout (timeout, 3 seconds; connect_timeout, 2), any non-2xx status, a redirect, a body that is not a JSON object, a reported hostname that is not the request's (or one of fancy-captcha.hostnames), a reported action that is not the expected one, or a v3 score below score_threshold. An outage must not be the way in.

Unconfigured. With a provider selected and a key missing, production refuses every submission and logs an error. Local and testing fall back to the built-in checks and log a warning that says so, so a missing key is loud rather than a silent bypass.

The honeypot and timing also run in front of a provider (builtin.with_providers), and a refused submission never reaches the provider.

Tokens are bounded before anything is sent: a string of at most max_token_length characters (2048 for Turnstile, as Cloudflare documents) from a fixed token alphabet, checked with strspn, not a regular expression.

Consent (optional, with fancy-compliance)

A third-party widget sets cookies and talks to its provider, so a host may want it behind consent:

When particle-academy/fancy-compliance is installed and the visitor has granted the category, the provider runs. When they have not, or fancy-compliance is not installed, the built-in checks run instead, with proof-of-work (fallback_pow), because refusing consent must not be the cheap way past the check. The UI makes the same choice from the same props.

fancy-compliance is not a dependency. Its ConsentGate contract is asked only when it exists and is bound.

Logging

Every refusal is one info line, fancy-captcha refused a submission., with driver, reason, action, route, and numbers or provider error codes where useful. Never a token, a solution, a timestamp or a secret: provider error codes are logged only when they have the documented lower-case-with-dashes shape, and an exception is logged by class name, because its message can carry the request. The IP address is left out unless log.ip is true. log.channel picks the channel.

Testing your app

Captcha::fake() throws in production, where it would be a bypass.

Custom drivers

A driver implements FancyCaptcha\Contracts\Verifier and must fail closed.

Agents

An agent may read whether a form is protected and what state it is in. It must never solve or submit a captcha for a person: that is the one thing the check exists to tell apart. Nothing in this package helps it do so.

Licence

MIT.


All versions of fancy-captcha with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
ext-json Version *
illuminate/cache Version ^13.0
illuminate/contracts Version ^13.0
illuminate/http Version ^13.0
illuminate/log Version ^13.0
illuminate/routing Version ^13.0
illuminate/support Version ^13.0
illuminate/validation Version ^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 particle-academy/fancy-captcha contains the following files

Loading the files please wait ...