Download the PHP package websk/php-captcha without Composer

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

WebSK PHP Captcha

websk/php-captcha generates PNG CAPTCHA images and provides Slim 4 route handlers for generating and validating them.

Requirements

Installation

Install the package with Composer:

The package is available on Packagist.

Slim integration

Register the CAPTCHA routes on an existing Slim application:

This adds two named GET routes:

Route Name Response
/captcha/generate captcha:generate image/png
/captcha/check_ajax captcha:check_ajax JSON true or false

Display the generated image and use the captcha field for the entered code:

The validation route accepts the code from parsed request data or the query string:

The expected value is stored in the server-side PHP session and is removed after a non-empty validation attempt. Generate a new image before retrying. When no session is active, the package starts one with strict mode, an HttpOnly cookie, and SameSite=Lax by default. Existing session settings are used when the application starts the session first.

Request handlers pass their PSR-7 request directly to Captcha::check(). Code outside a handler can do the same:

Demo

Run the bundled Slim application:

Then open http://localhost:8000. The root route redirects to the generated CAPTCHA image.

Development

Run syntax checks, PHPUnit, and PHPStan together:

The individual commands are also available:

Upgrade from 2.x

Version 3.0 stores the expected CAPTCHA value in the server-side session. The 2.x client-side CAPTCHA cookie is no longer trusted. Applications must have PHP sessions available and should pass the current PSR-7 request to Captcha::check().

License

This project is licensed under the MIT License.


All versions of php-captcha with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
ext-mbstring Version *
ext-gd Version *
ext-session Version *
slim/slim Version ^4.15
websk/php-slim Version 2.4.*
websk/php-utils Version 3.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 websk/php-captcha contains the following files

Loading the files please wait ...