{"id":21375254,"url":"https://github.com/gregwar/captchabundle","last_synced_at":"2025-05-15T08:09:36.556Z","repository":{"id":434996,"uuid":"2270318","full_name":"Gregwar/CaptchaBundle","owner":"Gregwar","description":"Symfony bundle implementing a \"captcha\" form type","archived":false,"fork":false,"pushed_at":"2024-06-07T11:13:56.000Z","size":270,"stargazers_count":350,"open_issues_count":65,"forks_count":129,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-04-14T12:18:25.053Z","etag":null,"topics":[],"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/Gregwar.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2011-08-25T20:16:55.000Z","updated_at":"2025-03-31T15:03:12.000Z","dependencies_parsed_at":"2024-06-06T15:08:54.549Z","dependency_job_id":null,"html_url":"https://github.com/Gregwar/CaptchaBundle","commit_stats":{"total_commits":204,"total_committers":53,"mean_commits":3.849056603773585,"dds":0.5392156862745099,"last_synced_commit":"2b55ba41fd890f1a94d30e53a530c344bf12d6a5"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gregwar%2FCaptchaBundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gregwar%2FCaptchaBundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gregwar%2FCaptchaBundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gregwar%2FCaptchaBundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Gregwar","download_url":"https://codeload.github.com/Gregwar/CaptchaBundle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248877968,"owners_count":21176244,"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":[],"created_at":"2024-11-22T09:09:28.157Z","updated_at":"2025-04-14T12:18:39.114Z","avatar_url":"https://github.com/Gregwar.png","language":"PHP","funding_links":["https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=YUXRLWHQSWS6L"],"categories":[],"sub_categories":[],"readme":"Gregwar's CaptchaBundle\n=====================\n\n[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=YUXRLWHQSWS6L)\n\nThe `GregwarCaptchaBundle` adds support for a captcha form type for the\nSymfony form component.\n\nIt uses [gregwar/captcha](https://github.com/Gregwar/Captcha) as captcha generator, which is a separate standalone library that can be used for none-symfony projects.\n\nCompatibility with Symfony\n==========================\n\n| CaptchaBundle |  Symfony  |   PHP    |\n|:-------------:|:---------:|:--------:|\n|     2.3.*     | 6.* - 7.* | \u003e= 8.0.2 |\n|     2.2.*     | 5.* - 6.* |  \u003e= 7.1  |\n|     2.1.*     | 4.* - 5.* |  \u003e= 7.1  |\n|     2.0.*     | 2.8 - 3.* | \u003e= 5.3.9 |\n|      1.*      | 2.1 - 2.7 | \u003e= 5.3.0 |\n\n\nInstallation\n============\n\n### Step 1: Download the GregwarCaptchaBundle\n\nUse composer require to download and install the package. \nAt the end of the installation, the bundle is automatically registered thanks to the Symfony recipe.\n\n``` bash\n    composer require gregwar/captcha-bundle\n```\n\nIf you don't use flex, register it manually:\n```php\n\u003c?php\n// config/bundles.php\nreturn [\n    // ...\n    Gregwar\\CaptchaBundle\\GregwarCaptchaBundle::class =\u003e ['all' =\u003e true]\n];\n```\n\nConfiguration\n=============\n\nIf you need to customize the global bundle configuration, you can create a  `/config/packages/gregwar_captcha.yaml` file with your configuration:\n``` yaml\ngregwar_captcha:\n  width: 160\n  height: 50\n```\n\nUsage\n=====\n\nYou can use the \"captcha\" type in your forms this way:\n\n``` php\n\u003c?php\nuse Gregwar\\CaptchaBundle\\Type\\CaptchaType;\n// ...\n$builder-\u003eadd('captcha', CaptchaType::class); // That's all !\n// ...\n```\n\nNote that the generated image will, by default, be embedded in the HTML document\nto avoid dealing with route and subrequests.\n\nOptions\n=======\n\nYou can define the following configuration options globally:\n\n* **image_folder**: name of folder for captcha images relative to public web folder in case **as_file** is set to true (default=\"captcha\")\n* **web_path**: absolute path to public web folder (default='%kernel.project_dir%/public')\n* **gc_freq**: frequency of garbage collection in fractions of 1 (default=100)\n* **expiration**: maximum lifetime of captcha image files in minutes (default=60)\n\nYou can define the following configuration options globally or on the CaptchaType itself:\n\n* **width**: the width of the captcha image (default=120)\n* **height**: the height of the captcha image (default=40)\n* **disabled**: disable globally the CAPTCHAs (can be useful in dev environment), it will\n  still appear but won't be editable and won't be checked\n* **length**: the length of the captcha (number of chars, default 5)\n* **quality**: jpeg quality of captchas (default=30)\n* **charset**: the charset used for code generation (default=abcdefhjkmnprstuvwxyz23456789)\n* **font**: the font to use (default is random among some pre-provided fonts), this should be an absolute path\n* **keep_value**: the value will be the same until the form is posted, even if the page is refreshed (default=true)\n* **as_file**: if set to true an image file will be created instead of embedding to please IE6/7 (default=false)\n* **as_url**: if set to true, a URL will be used in the image tag and will handle captcha generation. This can be used in a multiple-server environment and support IE6/7 (default=false)\n* **invalid_message**: error message displayed when an non-matching code is submitted (default=\"Bad code value\", see the translation section for more information)\n* **bypass_code**: code that will always validate the captcha (default=null)\n* **whitelist_key**: the session key to use for keep the session keys that can be used for captcha storage, when using as_url (default=captcha_whitelist_key)\n* **reload**: adds a link to reload the code\n* **humanity**: number of extra forms that the user can submit after a correct validation, if set to a value different of 0, only 1 over (1+humanity) forms will contain a CAPTCHA (default=0, i.e each form will contain the CAPTCHA)\n* **distortion**: enable or disable the distortion on the image (default=true, enabled)\n* **max_front_lines**, **max_behind_lines**: the maximum number of lines to draw on top/behind the image. `0` will draw no lines; `null` will use the default algorithm (the\nnumber of lines depends on the size of the image). (default=null)\n* **background_color**: sets the background color, if you want to force it, this should be an array of r,g \u0026b, for instance [255, 255, 255] will force the background to be white\n* **background_images**: Sets custom user defined images as the captcha background (1 image is selected randomly). It is recommended to turn off all the effects on the image (ignore_all_effects). The full paths to the images must be passed.\n* **interpolation**: enable or disable the interpolation on the captcha\n* **ignore_all_effects**: Recommended to use when setting background images, will disable all image effects.\n* **session_key**, if you want to host multiple CAPTCHA on the same page, you might have different session keys to ensure proper storage of the clear phrase for those different forms\n\nExample :\n\n``` php\n\u003c?php\nuse Gregwar\\CaptchaBundle\\Type\\CaptchaType;\n// ...\n$builder-\u003eadd('captcha', CaptchaType::class, array(\n    'width' =\u003e 200,\n    'height' =\u003e 50,\n    'length' =\u003e 6,\n));\n```\n\nYou can also set these options for your whole application using the `gregwar_captcha`\nconfiguration entry in your `config.yml` file:\n``` yaml \ngregwar_captcha:\n    width: 200\n    height: 50\n    length: 6\n```\n\nTranslation\n===========\n\nThe messages are using the translator, you can either change the `invalid_message` option or translate it. Any contribution about the language is welcome !\n\nAs URL\n============\nTo use a URL to generate a captcha image, you must add the bundle's routing configuration to your `config/routes.yaml` file:\n\n``` yaml \ngregwar_captcha_routing:\n    resource: \"@GregwarCaptchaBundle/Resources/config/routing/routing.yml\"\n```\n\nThis will use the bundle's route of `/generate-captcha/{key}` to handle the generation. If this route conflicts with an application route, you can prefix the bundle's routes when you import:\n\n``` yaml \ngregwar_captcha_routing:\n    resource: \"@GregwarCaptchaBundle/Resources/config/routing/routing.yml\"\n    prefix: /_gcb\n```\n\nSince the session key is transported in the URL, it's also added in another session array, under the `whitelist_key` key, for security reasons\n\nForm Theming\n============\n\nThe widget support the standard Symfony theming, see the [documentation](http://symfony.com/doc/current/book/forms.html#form-theming) for details on how to accomplish this.\n\nThe default rendering is:\n\n``` twig\n{% block captcha_widget %}\n{% spaceless %}\n    \u003cimg src=\"{{ captcha_code }}\" title=\"captcha\" width=\"{{ captcha_width }}\" height=\"{{ captcha_height }}\" /\u003e\n    {{ form_widget(form) }}\n{% endspaceless %}\n{% endblock %}\n```\n\nImage creation\n==============\nIf you choose to use image files instead of embedding the widget will execute a garbage collection\nrandomly and delete images that exceed the configured lifetime.\n\nUse internal Quality-Tools\n==============\n\n```\nvendor/bin/phpstan analyse\nvendor/bin/ecs check .\n```\n\nLicense\n=======\nThis bundle is under the MIT license. See the complete license in the bundle:\n    LICENSE\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregwar%2Fcaptchabundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgregwar%2Fcaptchabundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregwar%2Fcaptchabundle/lists"}