PHPackages                             wuori/laravel-unique-gmail-validation - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. wuori/laravel-unique-gmail-validation

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

wuori/laravel-unique-gmail-validation
=====================================

A validation rule to test uniqueness of Gmail addresses with ./+ modifiers.

1.0.0(5y ago)012MITPHPPHP ^7.3|^8.0

Since Apr 5Pushed 5y ago1 watchersCompare

[ Source](https://github.com/wuori/laravel-unique-gmail-validation)[ Packagist](https://packagist.org/packages/wuori/laravel-unique-gmail-validation)[ Docs](https://github.com/wuori/laravel-unique-gmail-validation)[ RSS](/packages/wuori-laravel-unique-gmail-validation/feed)WikiDiscussions main Synced 2d ago

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

Validate uniqueness of Gmail addresses
======================================

[](#validate-uniqueness-of-gmail-addresses)

[![Latest Version on Packagist](https://camo.githubusercontent.com/cf4c2ee51e1acf0ca9180990f7a63f5756b284732f0e82540d16e6d361f18e59/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f77756f72692f6c61726176656c2d756e697175652d676d61696c2d76616c69646174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/wuori/laravel-unique-gmail-validation)[![Total Downloads](https://camo.githubusercontent.com/7356213d0ef5ff1108ad1c39f06f83c45eb8cd473831c1e5244c4d8779b21b8e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f77756f72692f6c61726176656c2d756e697175652d676d61696c2d76616c69646174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/wuori/laravel-unique-gmail-validation)

Gmail [allows two modifiers](https://gmail.googleblog.com/2008/03/2-hidden-ways-to-get-more-from-your.html), `+` and `.` to be added to your email address without affecting delivery. For example, `michaelwuori@gmail.com` and `michael.wuori@gmail.com` both work as valid addresses to the same Gmail account.

The period (`.`) modifier can be placed anywhere within your account name, as in the example above.

The plus (`+`) modifier can be appended to your account name. Example: `michael.wuori+junk@gmail.com`.

This validation rule removes any period modifiers as well as any `+foo` appendages then compares the address to any existing `@gmail.com` emails that exist in the targeted model.

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

[](#installation)

You can install the package via composer:

```
composer require wuori/laravel-unique-gmail-validation
```

The package will automatically register itself.

### Using the UniqueGmail Rule

[](#using-the-uniquegmail-rule)

Include the rule:

```
...
use Illuminate\Http\Request;
use Wuori\UniqueGmail\UniqueGmail;
...
```

Attach the rule to an email field, passing the Model you wish to validate against as the first parameter.

If no Model is passed, the rule will default to `\App\Models\User`.

```
// default User model
$validator = $request->validate([
    'email' => [new UniqueGmail()]
]);

// custom model
$validator = $request->validate([
    'email' => [new UniqueGmail(\App\Models\Customers::class)]
]);

// combined with other rules
$validator = $request->validate([
    'email' => ['required','email','unique:users,email,NULL,id', new UniqueGmail(\App\Models\User::class)]
]);
```

This validation rule will pass if the id of the logged in user matches the `user_id` on `TestModel` who's it is in the `model_id` key of the request.

### Custom Error Message

[](#custom-error-message)

By default the `UniqueGmail` rule will use Laravel's built-in `unique` validation message (`trans('validation.unique')`).

You can supply your own message as an entry to the second parameter, `$options`:

```
$options = [
    'message' => 'An account already exists for :existing_email, a varient of :requested_email.'
];
$validator = $request->validate([
    'email' => [new UniqueGmail(\App\Models\User::class, $options)]
]);
```

The custom message accepts two optional attributes to replace:

`:existing_email` is replaced with the matching (existing) email address.

`:requested_email` is replaced with the email address provided in the request.

### Testing

[](#testing)

Coming soon...

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

1864d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/96183?v=4)[Michael Wuori](/maintainers/wuori)[@wuori](https://github.com/wuori)

---

Top Contributors

[![wuori](https://avatars.githubusercontent.com/u/96183?v=4)](https://github.com/wuori "wuori (8 commits)")

---

Tags

laravelvalidationemailuniquegmaillaravel-validation

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/wuori-laravel-unique-gmail-validation/health.svg)

```
[![Health](https://phpackages.com/badges/wuori-laravel-unique-gmail-validation/health.svg)](https://phpackages.com/packages/wuori-laravel-unique-gmail-validation)
```

###  Alternatives

[propaganistas/laravel-disposable-email

Disposable email validator

5762.6M6](/packages/propaganistas-laravel-disposable-email)[erag/laravel-disposable-email

A Laravel package to detect and block disposable email addresses.

226102.4k](/packages/erag-laravel-disposable-email)[martian/spammailchecker

A laravel package that protect users from entering non-existing/spam email addresses.

422.0k](/packages/martian-spammailchecker)[osiemsiedem/laravel-autolink

A Laravel package for converting URLs in a given string of text into clickable links.

13126.3k](/packages/osiemsiedem-laravel-autolink)[kouz/laravel-mailgun-email-validation

Laravel email validation that uses the Mailgun API for a three-step validation check.

11141.0k1](/packages/kouz-laravel-mailgun-email-validation)[ashallendesign/laravel-mailboxlayer

A lightweight Laravel package for validating emails using the Mailbox Layer API.

762.0k](/packages/ashallendesign-laravel-mailboxlayer)

PHPackages © 2026

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