{"id":15026725,"url":"https://github.com/andanteproject/recaptcha-bundle","last_synced_at":"2025-04-09T20:21:38.435Z","repository":{"id":56947635,"uuid":"342227271","full_name":"andanteproject/recaptcha-bundle","owner":"andanteproject","description":"A Symfony Bundle to easily integrate Google reCAPTCHA into Symfony Form","archived":false,"fork":false,"pushed_at":"2021-12-17T09:40:04.000Z","size":22,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-23T22:13:26.032Z","etag":null,"topics":["google-recaptcha","google-recaptcha-v2","php","php7","php74","symfony","symfony-bundle","symfony-form","symfony-formtype"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andanteproject.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-25T11:49:10.000Z","updated_at":"2022-02-26T22:21:20.000Z","dependencies_parsed_at":"2022-08-21T03:10:25.943Z","dependency_job_id":null,"html_url":"https://github.com/andanteproject/recaptcha-bundle","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andanteproject%2Frecaptcha-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andanteproject%2Frecaptcha-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andanteproject%2Frecaptcha-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andanteproject%2Frecaptcha-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andanteproject","download_url":"https://codeload.github.com/andanteproject/recaptcha-bundle/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247713294,"owners_count":20983681,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["google-recaptcha","google-recaptcha-v2","php","php7","php74","symfony","symfony-bundle","symfony-form","symfony-formtype"],"created_at":"2024-09-24T20:04:58.350Z","updated_at":"2025-04-09T20:21:38.410Z","avatar_url":"https://github.com/andanteproject.png","language":"PHP","readme":"![Andante Project Logo](https://github.com/andanteproject/recaptcha-bundle/blob/main/andanteproject-logo.png?raw=true)\n# Google ReCAPTCHA Bundle \n#### Symfony Bundle - [AndanteProject](https://github.com/andanteproject)\n[![Latest Version](https://img.shields.io/github/release/andanteproject/recaptcha-bundle.svg)](https://github.com/andanteproject/recaptcha-bundle/releases)\n![Github actions](https://github.com/andanteproject/recaptcha-bundle/actions/workflows/workflow.yml/badge.svg?branch=main)\n![Framework](https://img.shields.io/badge/Symfony-4.x|5.x|6.x-informational?Style=flat\u0026logo=symfony)\n![Php7](https://img.shields.io/badge/PHP-%207.4|8.x-informational?style=flat\u0026logo=php)\n![PhpStan](https://img.shields.io/badge/PHPStan-Level%208-syccess?style=flat\u0026logo=php) \n\nA Symfony Bundle to easily integrate [Google reCAPTCHA](https://www.google.com/recaptcha/) into [Symfony Form](https://symfony.com/doc/current/forms.html). \n\n## Requirements\nSymfony 4.x-6.x and PHP 7.4-8.x.\n\n## Install\nVia [Composer](https://getcomposer.org/):\n```bash\n$ composer require andanteproject/recaptcha-bundle\n```\n\n## Features\n- Add [Google reCAPTCHA](https://www.google.com/recaptcha/) to your [Symfony Form](https://symfony.com/doc/current/forms.html) just like you do with every other `FormType`;\n- Works like magic ✨.\n\n## Install\nAfter [install](#install), make sure you have the bundle registered in your symfony bundles list (`config/bundles.php`):\n```php\nreturn [\n    /// bundles...\n    Andante\\ReCaptchaBundle\\AndanteReCaptchaBundle::class =\u003e ['all' =\u003e true],\n    /// bundles...\n];\n```\nThis should have been done automagically if you are using [Symfony Flex](https://flex.symfony.com). Otherwise, just register it by yourself.\n\n## Configuration\nCreate a new `andante_re_captcha.yaml` configuration file and sets [Google ReCAPTCHA v2 `secret` and `site_key`](http://www.google.com/recaptcha/admin).\n```yaml\nandante_re_captcha:\n  secret: 'put_here_your_google_recaptcha_v2_secret'\n  site_key: 'put_here_your_google_recaptcha_v2_site_key'\n```\n### Dev/test environment Configuration \n**Please note:** If you don't want to be annoyed by recaptcha in your development/test environment, just use `secret key` and `site key` you can find in this [Google ReCAPTCHA documentation page](https://developers.google.com/recaptcha/docs/faq#id-like-to-run-automated-tests-with-recaptcha.-what-should-i-do).\nFurthermore, you can create a `test` configuration to disable `Andante\\ReCaptchaBundle\\Validator\\Constraint\\ReCaptchaValidator` in `test` environment:\n```yaml\nandante_re_captcha:\n  enable_validation: false #default: true\n```\n\n## Usage\nAfter this, you can add `Andante\\ReCaptchaBundle\\Form\\ReCaptchaType` Form type in your forms like you always do with other types.\n```php\n\u003c?php\nuse Andante\\ReCaptchaBundle\\Form\\ReCaptchaType;\nuse Symfony\\Component\\Form\\AbstractType;\n\nclass RegistrationFormType extends AbstractType\n{\n    public function buildForm(FormBuilderInterface $builder, array $options): void\n    {\n        $builder\n            // ...\n            // All your form fields\n            // ...\n            -\u003eadd('recaptcha', ReCaptchaType::class);\n    }\n}\n```\n**Done!** 🎉\n\nYou also have 2 options to change ReCAPTCHA _theme_ or _size_.\n```php\n$builder-\u003eadd('recaptcha', ReCaptchaType::class, [\n    'theme' =\u003e 'dark', // default is \"light\"\n    'size' =\u003e  'compact' // default is \"normal\"\n]);\n```\nUsing the option `'theme'` =\u003e `'dark'` is especially useful if your app has a dark mode.\n\n## How to change validation process\nValidation is handled by `Andante\\ReCaptchaBundle\\Validator\\Constraint\\ReCaptchaValidator`, which is a default constraint inside `ReCaptchaType` options.\nIf you want to replace it with your own or disable it for whatever reason, just empty/replace form type `constraints` option.\n```php\n$builder-\u003eadd('recaptcha', ReCaptchaType::class, [\n    'constraints' =\u003e [\n        // Default value is Constraints\\NotBlank + Constraint\\Recaptcha \n    ]\n]);\n```\n\nBuilt with love ❤️ by [AndanteProject](https://github.com/andanteproject) team.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandanteproject%2Frecaptcha-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandanteproject%2Frecaptcha-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandanteproject%2Frecaptcha-bundle/lists"}