sergiors / recaptcha-service-provider
ReCaptcha for Silex
dev-master
2016-11-11 16:12 UTC
Requires
- php: >=5.5
- google/recaptcha: ~1.1
- silex/silex: ^2
- symfony/form: ^3.1
- symfony/validator: ^3.1
- twig/twig: ^1.27
Requires (Dev)
- pdepend/pdepend: ~2.0
- phing/phing: ~2.10
- phploc/phploc: ~2.1
- phpmd/phpmd: ~2.2
- phpunit/phpunit: ~4.8
- sebastian/phpcpd: ~2.0
- squizlabs/php_codesniffer: ~2.1
This package is not auto-updated.
Last update: 2024-11-10 01:39:19 UTC
README
Register your site in Google reCAPTCHA
Install
composer require sergiors/recaptcha-service-provider "dev-master"
use Silex\Provider\FormServiceProvider; use Silex\Provider\ValidatorServiceProvider; use Silex\Provider\TwigServiceProvider; use Sergiors\Silex\Provider\RecaptchaServiceProvider; $app->register(new FormServiceProvider()); $app->register(new ValidatorServiceProvider()); $app->register(new TwigServiceProvider()); $app->register(new RecaptchaServiceProvider(), [ 'recaptcha.sitekey' => '', 'recaptcha.secretkey' => '', ]);
Form
use Symfony\Component\Form\Extension\Core\Type\FormType; use Sergiors\Silex\Form\Type\RecaptchaType; use Sergiors\Silex\Validator\Constraints\Recaptcha; $form = $app['form.factory']->createBuilder(FormType::class, []) ->add('recaptcha', RecaptchaType::class, [ 'constraints' => [ new Recaptcha() ] ]) ->getForm();
In your template
{{ form_widget(form.recaptcha) }}
License
MIT