{"id":15019845,"url":"https://github.com/ossycodes/friendlycaptcha","last_synced_at":"2025-09-06T17:31:04.396Z","repository":{"id":61825229,"uuid":"555468551","full_name":"ossycodes/friendlycaptcha","owner":"ossycodes","description":"A simple package to help integrate FriendlyCaptcha.","archived":false,"fork":false,"pushed_at":"2024-07-02T07:16:20.000Z","size":45,"stargazers_count":21,"open_issues_count":0,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-25T20:09:18.398Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/ossycodes.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-10-21T16:34:37.000Z","updated_at":"2024-07-02T07:10:26.000Z","dependencies_parsed_at":"2023-02-07T16:10:26.038Z","dependency_job_id":null,"html_url":"https://github.com/ossycodes/friendlycaptcha","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ossycodes%2Ffriendlycaptcha","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ossycodes%2Ffriendlycaptcha/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ossycodes%2Ffriendlycaptcha/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ossycodes%2Ffriendlycaptcha/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ossycodes","download_url":"https://codeload.github.com/ossycodes/friendlycaptcha/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232133898,"owners_count":18477299,"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-09-24T19:54:11.193Z","updated_at":"2025-01-01T23:08:40.158Z","avatar_url":"https://github.com/ossycodes.png","language":"PHP","funding_links":["https://www.paypal.com/paypalme/osaigbovoemmanuel"],"categories":[],"sub_categories":[],"readme":"# A simple package to help integrate FriendlyCaptcha.\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/ossycodes/friendlycaptcha.svg?style=flat-square)](https://packagist.org/packages/ossycodes/friendlycaptcha)\n[![Total Downloads](https://img.shields.io/packagist/dt/ossycodes/friendlycaptcha.svg?style=flat-square)](https://packagist.org/packages/ossycodes/friendlycaptcha)\n![GitHub Actions](https://github.com/ossycodes/friendlycaptcha/actions/workflows/main.yml/badge.svg)\n\nThis package helps in setting up and validating FriendlyCaptcha widget and response in your Laravel applications\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require ossycodes/friendlycaptcha\n```\n\n### Configuration\n\nAdd `FRIENDLY_CAPTCHA_SECRET`, `FRIENDLY_CAPTCHA_SITEKEY` and optional `FRIENDLY_CAPTCHA_PUZZLE_ENDPOINT`, `FRIENDLY_CAPTCHA_VERIFY_ENDPOINT` in **.env** file :\n\n```\nFRIENDLY_CAPTCHA_SECRET=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\nFRIENDLY_CAPTCHA_SITEKEY=XXXXXXXXXXXXXXXX\nFRIENDLY_CAPTCHA_PUZZLE_ENDPOINT=https://api.friendlycaptcha.com/api/v1/puzzle #optional\nFRIENDLY_CAPTCHA_VERIFY_ENDPOINT=https://api.friendlycaptcha.com/api/v1/siteverify #optional\n```\n\nYou can obtain your site-key from [here](https://docs.friendlycaptcha.com/#/installation?id=_1-generating-a-sitekey) and secret from [here](https://apiserver-prod.friendlycaptcha.eu/dashboard/accounts/1118678876/apikeys)\n\n## Usage\n\nFor FriendlyCaptcha widget scripts from a CDN, add the Blade directive `@friendlyCaptchaRenderWidgetScripts` in your layout file. This should be added to the `\u003chead\u003e` of your document.\n\n```blade\n\u003chtml\u003e\n    \u003chead\u003e\n        @friendlyCaptchaRenderWidgetScripts()\n    \u003c/head\u003e\n    \u003cbody\u003e\n        {{ $slot }}\n    \u003c/body\u003e\n\u003c/html\u003e\n```\n\nor if you don't want to use the Blade directive you can do this instead\n\n```php\n {!! FriendlyCaptcha::renderWidgetScripts() !!}\n```\n\nYou have two options on how to add the script tag either from unpkg (default) or from jsdelivr\n\n`@friendlyCaptchaRenderWidgetScripts()`\nor\n`@friendlyCaptchaRenderWidgetScripts('jsdelivr')`\n\n`{!! FriendlyCaptcha::renderWidgetScripts() !!}`\nor\n`{!! FriendlyCaptcha::renderWidgetScripts('jsdelivr') !!}`\n\nYou can also host the FriendlyCaptcha widget scripts yourself:\n\n```\nnpm install --save friendly-challenge@0.9.9\n```\n\nAnd import it in your app:\n\n```js\nimport \"friendly-challenge/widget\";\n```\n\n\nOnce that's done, you can call the `renderWidget()` method  in `\u003cform\u003e` to output the appropriate markup (friendlycaptcha widget) with your site key configured.\n\n```blade\n\u003cform action=\"/\" method=\"POST\"\u003e\n\n    {!! FriendlyCaptcha::renderWidget() !!}\n\n    or with custom theme\n\n    {!! FriendlyCaptcha::renderWidget(['dark-theme' =\u003e true]) !!}\n\n    or with custom language\n\n    {!! FriendlyCaptcha::renderWidget(['data-lang' =\u003e 'en']) !!}\n\n    \u003cbutton\u003e\n        Submit\n    \u003c/button\u003e\n\u003c/form\u003e\n```\n\nFinally On the server, use the provided validation rule to validate the CAPTCHA response.\n\n```php\nuse Illuminate\\Validation\\Rule;\n\npublic function submit(Request $request)\n{\n    $request-\u003evalidate([\n        'frc-captcha-solution' =\u003e ['required', Rule::friendlycaptcha()],\n    ]);\n}\n```\n\nIf you prefer to not use a macro, you can resolve an instance of the rule from the container via dependency injection or the `app()` helper.\n\n```php\nuse Ossycodes\\FriendlyCaptcha\\Rules\\FriendlyCaptcha;\n\npublic function submit(Request $request, FriendlyCaptcha $friendlyCaptcha)\n{\n    $request-\u003evalidate([\n        'frc-captcha-solution' =\u003e ['required', $friendlyCaptcha],\n    ]);\n}\n```\n\n```php\nuse Ossycodes\\FriendlyCaptcha\\Rules\\FriendlyCaptcha;\n\npublic function submit(Request $request)\n{\n    $request-\u003evalidate([\n        'frc-captcha-solution' =\u003e ['required', app(FriendlyCaptcha::class)],\n    ]);\n}\n```\n\n### Testing\n\n```bash\ncomposer test\n```\n\n### Security\n\nIf you discover any security related issues, please email osaigbovoemmanuel1@gmail.com instead of using the issue tracker.\n\n## Credits\n\n-   [Osaigbovo Emmanuel](https://github.com/ossycodes)\n-   [Julian Dorn](https://github.com/wi-wissen)\n-   [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n\n## How do I say Thank you?\n\nPlease buy me a cup of coffee https://www.paypal.com/paypalme/osaigbovoemmanuel , Leave a star and follow me on [Twitter](https://twitter.com/ossycodes) .\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fossycodes%2Ffriendlycaptcha","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fossycodes%2Ffriendlycaptcha","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fossycodes%2Ffriendlycaptcha/lists"}