Download the PHP package redcodede/captcha without Composer

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

Captcha

Captcha is a Statamic addon that makes a classic captcha available for Statamic forms.

Features

This addon does:

Requirements

Statamic PHP
5.x 8.2+
6.x 8.3+

The same release works on both major versions — the addon does not use any Statamic APIs that changed between 5 and 6. It requires the gd, mbstring and fileinfo PHP extensions (pulled in via gregwar/captcha).

Accessibility Notice

Please note that this captcha requires vision to solve. This captcha provides an image with a 4-character string that needs to be entered in the coresponding form field.

How to Install

You can search for this addon in the Tools > Addons section of the Statamic control panel and click install, or run the following command from your project root:

How to Use

1. Install the addon

Install the Captcha addon into your Statamic project as described in How to Install.

2. Add new validation rule

To use the Captcha in your form you need to add a new validation rule. Do this by running php artisan make:rule VerifyCaptcha in your terminal.

The new rule should contain these methods:

public function passes($attribute, mixed $value): bool { try { if (strtolower($_SESSION['phrase']) === strtolower($value)) { Captcha::refreshCaptcha(); return true; } else { return false; } } catch(\Exception $e) { return false; }

}

public function message(): string { return '__(validation.verify_captcha)'; }

The message handles the error messages you may want to define in resources > lang.

Extending App Service Provider Extending the App Service Provider is no longer necessary.

4. Add your form field

Your form needs to contain a text form field with the validation rules required and captcha.

5. Include the captcha into your form template

The form template should include the {{ refresh_captcha }} tag to generate a new captcha on reloading the form to get a fresh one every time.

Your form field template should include an img tag with the src of {{ captcha_image }}. This that will provide you with the image URL.

You can also add a button which will let the user generate another captcha image. <button type="button" data-refresh-url="{{ captcha_refresh_url }}">generate new captcha image</button>

Now you should be all set to use the Captcha on your own Website.

Error Messages & Translations

The failure message of the captcha validation rule ships translated for:

de_DE · en_GB · es_ES · fr_FR · it_IT · nl_NL · pl_PL · pt_BR

Statamic uses the short lang code of a site (de) unless the site config sets a full lang (de_DE), so each language is registered under both — you do not have to configure anything. Sites in a language that is not listed fall back to en.

Overriding a message

Either define captcha in your own lang/{locale}/validation.php — Laravel checks the app's own files first:

Or publish the addon's files and edit them in place:


All versions of captcha with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
statamic/cms Version ^5.0 || ^6.0
gregwar/captcha Version ^1.3
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 redcodede/captcha contains the following files

Loading the files please wait ...