|
|
|
@ -12,10 +12,10 @@ Compatibility with Symfony
|
|
|
|
|
==========================
|
|
|
|
|
|
|
|
|
|
| CaptchaBundle | Symfony | PHP |
|
|
|
|
|
|:---------------:|:---------:|:-------:|
|
|
|
|
|
| 3.* | 4.* - 5.* | 7.1 > |
|
|
|
|
|
| 2.* | 2.8 - 3.* | 5.3.9 > |
|
|
|
|
|
| 1.* | 2.1 - 2.7 | 5.3.0 > |
|
|
|
|
|
|:---------------:|:---------:|:--------:|
|
|
|
|
|
| 2.1.* | 4.* - 5.* | >= 7.1 |
|
|
|
|
|
| 2.0.* | 2.8 - 3.* | >= 5.3.9 |
|
|
|
|
|
| 1.* | 2.1 - 2.7 | >= 5.3.0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Installation
|
|
|
|
@ -24,20 +24,30 @@ Installation
|
|
|
|
|
### Step 1: Download the GregwarCaptchaBundle
|
|
|
|
|
|
|
|
|
|
Use composer require to download and install the package.
|
|
|
|
|
At the end of the installation you can automaticly create the configuration thanks to the Symfony recipe.
|
|
|
|
|
At the end of the installation, the bundle is automatically registered thanks to the Symfony recipe.
|
|
|
|
|
|
|
|
|
|
``` bash
|
|
|
|
|
composer require gregwar/captcha-bundle
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
If you don't use flex, register it manually:
|
|
|
|
|
```php
|
|
|
|
|
<?php
|
|
|
|
|
// config/bundles.php
|
|
|
|
|
return [
|
|
|
|
|
// ...
|
|
|
|
|
Gregwar\CaptchaBundle\GregwarCaptchaBundle::class => ['all' => true]
|
|
|
|
|
];
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Configuration
|
|
|
|
|
=============
|
|
|
|
|
|
|
|
|
|
If you made the configuration automaticly trough the Symfony recipe, you should have the following config file `/config/packages/gregwar_captcha.yaml`
|
|
|
|
|
|
|
|
|
|
Otherwise you can create it manually `/config/packages/gregwar_captcha.yaml` with the following default configuration:
|
|
|
|
|
If you need to customize the global bundle configuration, you can create a `/config/packages/gregwar_captcha.yaml` file with your configuration:
|
|
|
|
|
``` yaml
|
|
|
|
|
gregwar_captcha: ~
|
|
|
|
|
gregwar_captcha:
|
|
|
|
|
width: 160
|
|
|
|
|
height: 50
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Usage
|
|
|
|
@ -91,6 +101,7 @@ number of lines depends on the size of the image). (default=null)
|
|
|
|
|
* **background_images**: Sets custom user defined images as the captcha background (1 image is selected randomly). It is recommended to turn off all the effects on the image (ignore_all_effects). The full paths to the images must be passed.
|
|
|
|
|
* **interpolation**: enable or disable the interpolation on the captcha
|
|
|
|
|
* **ignore_all_effects**: Recommended to use when setting background images, will disable all image effects.
|
|
|
|
|
* **session_key**, if you want to host multiple CAPTCHA on the same page, you might have different session keys to ensure proper storage of the clear phrase for those different forms
|
|
|
|
|
|
|
|
|
|
Example :
|
|
|
|
|
|
|
|
|
@ -121,13 +132,15 @@ The messages are using the translator, you can either change the `invalid_messag
|
|
|
|
|
|
|
|
|
|
As URL
|
|
|
|
|
============
|
|
|
|
|
To use a URL to generate a captcha image, you must add the bundle's routing configuration to your app/routing.yml file:
|
|
|
|
|
To use a URL to generate a captcha image, you must add the bundle's routing configuration to your `config/routes.yaml` file:
|
|
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
|
gregwar_captcha_routing:
|
|
|
|
|
resource: "@GregwarCaptchaBundle/Resources/config/routing/routing.yml"
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
This will use the bundle's route of "/generate-captcha/{key}" to handle the generation. If this route conflicts with an application route, you can prefix the bundle's routes when you import:
|
|
|
|
|
This will use the bundle's route of `/generate-captcha/{key}` to handle the generation. If this route conflicts with an application route, you can prefix the bundle's routes when you import:
|
|
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
|
gregwar_captcha_routing:
|
|
|
|
|
resource: "@GregwarCaptchaBundle/Resources/config/routing/routing.yml"
|
|
|
|
|