Merge branch 'master' of github.com:Gregwar/CaptchaBundle

This commit is contained in:
Gregwar 2015-12-07 14:25:30 +01:00
commit d328f215b2
3 changed files with 19 additions and 20 deletions

View File

@ -1,12 +1,8 @@
Gregwar's CaptchaBundle Gregwar's CaptchaBundle
===================== =====================
The `GregwarCaptchaBundle` adds support for a "captcha" form type for the The `GregwarCaptchaBundle` adds support for a captcha form type for the
Symfony2 form component. Symfony form component.
Important note: the master of this repository is containing current development
in order to work with Symfony 2.1. If you are using Symfony 2.0 please checkout
the 2.0 branch.
Installation Installation
============ ============
@ -17,7 +13,15 @@ Ultimately, the GregwarCaptchaBundle files should be downloaded to the
'vendor/bundles/Gregwar/CaptchaBundle' directory. 'vendor/bundles/Gregwar/CaptchaBundle' directory.
You can accomplish this several ways, depending on your personal preference. You can accomplish this several ways, depending on your personal preference.
The first method is the standard Symfony2 method. The first method is the standard Symfony method.
***Using Composer***
Use composer require to download and install the package.
``` bash
composer require gregwar/captcha-bundle
```
***Using the vendors script*** ***Using the vendors script***
@ -45,14 +49,6 @@ $ git submodule add git://github.com/Gregwar/CaptchaBundle.git vendor/bundles/Gr
$ git submodule update --init $ git submodule update --init
``` ```
***Using Composer***
Use composer require to download and install the package.
``` bash
composer require gregwar/captcha-bundle
```
### Step 2: Configure the Autoloader ### Step 2: Configure the Autoloader
If you use composer, you can skip this step. If you use composer, you can skip this step.
@ -99,8 +95,9 @@ You can use the "captcha" type in your forms this way:
```php ```php
<?php <?php
use Gregwar\CaptchaBundle\Type\CaptchaType;
// ... // ...
$builder->add('captcha', 'captcha'); // That's all ! $builder->add('captcha', CaptchaType::class); // That's all !
// ... // ...
``` ```
@ -147,8 +144,9 @@ Example :
```php ```php
<?php <?php
use Gregwar\CaptchaBundle\Type\CaptchaType;
// ... // ...
$builder->add('captcha', 'captcha', array( $builder->add('captcha', CaptchaType::class, array(
'width' => 200, 'width' => 200,
'height' => 50, 'height' => 50,
'length' => 6, 'length' => 6,

View File

@ -11,6 +11,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\OptionsResolver\OptionsResolverInterface; use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\Form\FormEvents; use Symfony\Component\Form\FormEvents;
use Symfony\Component\Translation\TranslatorInterface; use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Gregwar\CaptchaBundle\Validator\CaptchaValidator; use Gregwar\CaptchaBundle\Validator\CaptchaValidator;
use Gregwar\CaptchaBundle\Generator\CaptchaGenerator; use Gregwar\CaptchaBundle\Generator\CaptchaGenerator;
@ -143,7 +144,7 @@ class CaptchaType extends AbstractType
*/ */
public function getParent() public function getParent()
{ {
return 'text'; return TextType::class;
} }
/** /**

View File

@ -19,8 +19,8 @@
"require": { "require": {
"php": ">=5.5.0", "php": ">=5.5.0",
"gregwar/captcha": "~1.1", "gregwar/captcha": "~1.1",
"symfony/framework-bundle": "~2.1", "symfony/framework-bundle": "~2.1 || ~3.0",
"symfony/form": "~2.1" "symfony/form": "~2.1 || ~3.0"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {