diff --git a/README.md b/README.md index 50b78b5..d8b3f44 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,8 @@ Gregwar's CaptchaBundle ===================== -The `GregwarCaptchaBundle` adds support for a "captcha" form type for the -Symfony2 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. +The `GregwarCaptchaBundle` adds support for a captcha form type for the +Symfony form component. Installation ============ @@ -17,7 +13,15 @@ Ultimately, the GregwarCaptchaBundle files should be downloaded to the 'vendor/bundles/Gregwar/CaptchaBundle' directory. 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*** @@ -45,14 +49,6 @@ $ git submodule add git://github.com/Gregwar/CaptchaBundle.git vendor/bundles/Gr $ 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 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 add('captcha', 'captcha'); // That's all ! + $builder->add('captcha', CaptchaType::class); // That's all ! // ... ``` @@ -147,8 +144,9 @@ Example : ```php add('captcha', 'captcha', array( + $builder->add('captcha', CaptchaType::class, array( 'width' => 200, 'height' => 50, 'length' => 6, diff --git a/Type/CaptchaType.php b/Type/CaptchaType.php index 456d121..0da5afb 100644 --- a/Type/CaptchaType.php +++ b/Type/CaptchaType.php @@ -11,6 +11,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolverInterface; use Symfony\Component\Form\FormEvents; use Symfony\Component\Translation\TranslatorInterface; +use Symfony\Component\Form\Extension\Core\Type\TextType; use Gregwar\CaptchaBundle\Validator\CaptchaValidator; use Gregwar\CaptchaBundle\Generator\CaptchaGenerator; @@ -143,7 +144,7 @@ class CaptchaType extends AbstractType */ public function getParent() { - return 'text'; + return TextType::class; } /** diff --git a/composer.json b/composer.json index d1e81e6..22b31c8 100644 --- a/composer.json +++ b/composer.json @@ -19,8 +19,8 @@ "require": { "php": ">=5.5.0", "gregwar/captcha": "~1.1", - "symfony/framework-bundle": "~2.1", - "symfony/form": "~2.1" + "symfony/framework-bundle": "~2.1 || ~3.0", + "symfony/form": "~2.1 || ~3.0" }, "autoload": { "psr-4": {