PHPackages                             astritzeqiri/g-recaptcha - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. astritzeqiri/g-recaptcha

ActiveLaravel-plugin[Authentication &amp; Authorization](/categories/authentication)

astritzeqiri/g-recaptcha
========================

Easily add google recaptcha

1.0.3(9y ago)057MITPHPPHP &gt;=5.4.0CI failing

Since Aug 26Pushed 5y ago1 watchersCompare

[ Source](https://github.com/astritzeqiri/g-recaptcha)[ Packagist](https://packagist.org/packages/astritzeqiri/g-recaptcha)[ Docs](https://github.com/astritzeqiri/g-recaptcha)[ RSS](/packages/astritzeqiri-g-recaptcha/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (2)Versions (6)Used By (0)

[![StyleCI](https://camo.githubusercontent.com/5eda3917bbcdefdbbbfecae18c8148251adfb3b7eb24c3f5c981f6e226d0c85f/68747470733a2f2f7374796c6563692e696f2f7265706f732f36363634363136322f736869656c64)](https://styleci.io/repos/66646162/)[![Total Downloads](https://camo.githubusercontent.com/135c683e85bc6d3e747253c866b292f287e29358137cf40e268240a3a2887a58/68747470733a2f2f706f7365722e707567782e6f72672f6173747269747a65716972692f672d7265636170746368612f646f776e6c6f616473)](https://packagist.org/packages/astritzeqiri/g-recaptcha)

Google recaptcha for Laravel
============================

[](#google-recaptcha-for-laravel)

Easily add google recaptcha in Laravel.

Requirements
------------

[](#requirements)

- PHP &gt;=5.4
- Laravel &gt;= 5.0
- GuzzleHttp &gt;= 5.3

Installation
------------

[](#installation)

Add astritzeqiri/g-recaptcha to your composer.json file:

```
"require": {
    "astritzeqiri/g-recaptcha": "~1.0"
}
```

And do:

```
$ composer update

```

Or get composer to install the package:

```
$ composer require astritzeqiri/g-recaptcha

```

Configuration
-------------

[](#configuration)

Now you go and generate a new Google recaptcha on the link below:

[Google Recaptcha Generate](https://www.google.com/recaptcha/intro/index.html).

Then you go to your .env file and set these variables

```
# If you want to disable captchas put this to false by default this is true.
GRECAPTCHA_ENABLED=true

# The google recaptcha site key
GRECAPTCHA_KEY=SITE_KEY

# The google recaptcha secret key
GRECAPTCHA_SECRET=SECRET_KEY

```

You can also change these variables on the config file on config/grecaptcha.php file.

```
return [
	'enabled' => env("GRECAPTCHA_ENABLED", true),
	'site_key' => env("GRECAPTCHA_KEY"),
	'secret_key' => env("GRECAPTCHA_SECRET"),
];
```

### Registering the Package

[](#registering-the-package)

Register the service provider within the `providers` array found in `app/config/app.php`:

```
'providers' => array(
    // ...
    AstritZeqiri\GRecaptcha\GRecaptchaServiceProvider::class
)
```

Then you need to add GRecaptcha class within the `aliases` array found in `app/config/app.php`:

```
'aliases' => array(
    // ...
    'GRecaptcha' => AstritZeqiri\GRecaptcha\GRecaptcha::class,
)
```

Then you run php artisan vendor:publish to publish the start\_captchas script and also the recaptcha config file.

```
$ php artisan vendor:publish

```

Usage
-----

[](#usage)

First of all you need to call the grecaptcha scripts on the footer. The scripts are rendered only if you have an active captcha somewhere on you html.

```
// in blade.php files
{!! \GRecaptcha::renderScripts() !!}

// or in .php files

```

### Basic Example

[](#basic-example)

Now to render a new GRecaptcha you call the render method.

```
// by default it echo's it out
GRecaptcha::render();

// if you want to save the html in a variable you call
$grecaptchaHtml = GRecaptcha::render([], false);
```

If you want to get a new recaptcha instance:

```
$grecaptcha = GRecaptcha::generate();

// to render it you call
$grecaptcha->renderHtml();

// if you dont want it to be rendered but store the html you call
$grecaptchaHtml = $grecaptcha->build();
```

### Validation

[](#validation)

When you validate a form to validate the recaptcha you use the rule grecaptcha

```
$validator = Validator::make($inputs,
    ['g-recaptcha-response' => 'required|grecaptcha']
);
```

License
-------

[](#license)

[MIT](/LICENSE)

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 88.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

4

Last Release

3591d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8720176?v=4)[Astrit Zeqiri](/maintainers/astritzeqiri)[@astritzeqiri](https://github.com/astritzeqiri)

---

Top Contributors

[![astritzeqiri](https://avatars.githubusercontent.com/u/8720176?v=4)](https://github.com/astritzeqiri "astritzeqiri (16 commits)")[![gentritabazi](https://avatars.githubusercontent.com/u/35135482?v=4)](https://github.com/gentritabazi "gentritabazi (2 commits)")

---

Tags

captchagoogle-recaptchagrecaptchalaravellaravel-captchaphplaravelAuthenticationGoogle ReCaptchag-recaptcha

### Embed Badge

![Health badge](/badges/astritzeqiri-g-recaptcha/health.svg)

```
[![Health](https://phpackages.com/badges/astritzeqiri-g-recaptcha/health.svg)](https://phpackages.com/packages/astritzeqiri-g-recaptcha)
```

###  Alternatives

[statamic/cms

The Statamic CMS Core Package

4.8k3.6M932](/packages/statamic-cms)[backpack/crud

Quickly build admin interfaces using Laravel, Bootstrap and JavaScript.

3.4k3.7M220](/packages/backpack-crud)[unopim/unopim

UnoPim Laravel PIM

10.5k2.2k](/packages/unopim-unopim)[ellaisys/aws-cognito

Laravel Authentication using AWS Cognito (Web and API)

123256.9k1](/packages/ellaisys-aws-cognito)[mi-lopez/laravel-sso

Simple PHP SSO integration for Laravel

621.1k](/packages/mi-lopez-laravel-sso)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
