nvasic88 / laravel-captcha
Laravel package to generate and validate CAPTCHA.
Requires
- php: ^7.2|^8.0
- illuminate/config: ^6.0|^7.0|^8.0|^9.0|^10.0
- illuminate/contracts: ^6.0|^7.0|^8.0|^9.0|^10.0
- illuminate/http: ^6.0|^7.0|^8.0|^9.0|^10.0
- illuminate/routing: ^6.0|^7.0|^8.0|^9.0|^10.0
- illuminate/session: ^6.0|^7.0|^8.0|^9.0|^10.0
- illuminate/support: ^6.0|^7.0|^8.0|^9.0|^10.0
- illuminate/validation: ^6.0|^7.0|^8.0|^9.0|^10.0
Requires (Dev)
- orchestra/testbench: ^4.0|^5.0|^6.0|^7.0,^8.0
- phpunit/phpunit: ^8.0|^9.0
Suggests
- ext-gd: to use GD library based image processing.
- ext-imagick: to use Imagick based image processing.
This package is auto-updated.
Last update: 2024-04-14 23:45:23 UTC
README
Project is updated clone of https://github.com/nikazooz/laravel-captcha to match Laravel 9 and 10 dependency for Biologer project update
Laravel Captcha
Package for Laravel to easily generate and validate CAPTCHA.
Requirements
Version | PHP | Laravel | Status |
---|---|---|---|
0.1.* | >=7.0 | ^5.5 | Not supported |
1.* | >=7.2 | >=6.0 | Supported |
ImageMagick or GD extension for PHP is required to use with included drivers.
Verification code is stored in session, so session needs to be active on validated route and on web middleware group.
Installation
composer require nikazooz/laravel-captcha
Configuration
To change configurations, you need to publish the configurations file.
php artisan vendor:publish --provider="Nikazooz\LaravelCaptcha\CaptchaServiceProvider"
Reading the config file is the best way to find out what can be configured.
Usage
Easily get URL at which CAPTCHA image is available using the facade:
<?php use Nikazooz\LaravelCaptcha\Facades\Captcha; echo Captcha::url();
It adds
v
query parameter with random value in order to avoid browser caching.
To validate the code sent in request, use captcha
validator, registered by the package, on that parameter.
If you need the verification code, for example in tests, you can get it with the facade: Captcha::code();
License
The package is open-sourced software licensed under the MIT license.