Go to file
Grégoire Passault d7fe01fa54 Added LICENSE file 2011-08-29 17:56:24 +02:00
DependencyInjection Created captcha type (this works, but still no image generation) 2011-08-25 22:50:59 +02:00
Generator Adding title, width & height and updating README 2011-08-26 08:59:29 +02:00
Resources Adding title, width & height and updating README 2011-08-26 08:59:29 +02:00
Type The CAPTCHA type now works 2011-08-25 23:10:24 +02:00
Validator Created captcha type (this works, but still no image generation) 2011-08-25 22:50:59 +02:00
GregwarCaptchaBundle.php Created captcha type (this works, but still no image generation) 2011-08-25 22:50:59 +02:00
LICENSE Added LICENSE file 2011-08-29 17:56:24 +02:00
README.md Adding title, width & height and updating README 2011-08-26 08:59:29 +02:00

README.md

Gregwar's CaptchaBundle

GregwarCaptchaBundle provides the form type "captcha"

Installation

To install GregwarCaptchaBundle, first adds it to your deps:

[GregwarCaptchaBundle]
    git=git://github.com/Gregwar/CaptchaBundle.git
    target=/bundles/Gregwar/CaptchaBundle

And run php bin/vendors install. Then add the namespace to your app/autoload.php file:

<?php
...
'Gregwar' => __DIR__.'/../vendor/bundles',
...

And registers the bundle in your app/AppKernel.php:

<?php
//...
public function registerBundles()
{
    $bundles = array(
        ...
        new Gregwar\CaptchaBundle\GregwarCaptchaBundle(),
        ...
    );
...

Adds the following configuration to your app/config/config.yml:

gregwar_captcha: ~

Usage

You can use the "captcha" type in your forms this way:

<?php
    // ...
    $builder->add('captcha', 'captcha'); // That's all !
    // ...

Note that the generated image will be embeded in the HTML document, to avoid dealing with route and subrequests.

Form theming

If you want to put the image in an other way, you can form theme captcha_bundle (this is the default behavior) :

{% block captcha_widget %}
    <img src="{{ captcha_code }}" title="captcha" width="120" height="40" />
    {{ form_widget(form) }}
{% endblock %}

License

This bundle is under MIT license