Download the PHP package aliziodev/laravel-gmail-unique without Composer
On this page you can find all versions of the php package aliziodev/laravel-gmail-unique. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download aliziodev/laravel-gmail-unique
More information about aliziodev/laravel-gmail-unique
Files in aliziodev/laravel-gmail-unique
Package laravel-gmail-unique
Short Description A Laravel package that normalizes Gmail addresses during validation to prevent duplicate user registrations with Gmail's dot variations and plus aliases, ideal for SaaS applications with trial subscriptions.
License MIT
Informations about the package laravel-gmail-unique
Laravel Gmail Unique
Laravel Gmail Unique is a package that normalizes Gmail addresses during validation to prevent duplicate user registrations with Gmail's dot variations and plus aliases. Gmail treats addresses like [email protected], [email protected], and [email protected] as the same account, but standard validation treats them as different emails.
According to Google's official documentation Google: Getting messages sent to a dotted version of my address , if you add dots to a Gmail address, you'll still get that email. For example, if your email is [email protected], you own all dotted versions of your address:
This package ensures that your application recognizes these variations as the same email address, preventing duplicate accounts and improving user experience. This is especially recommended for SaaS systems with trial subscriptions to prevent users from creating multiple trial accounts using Gmail variations.
Features
- Normalizes Gmail addresses by removing dots and plus aliases
- Prevents duplicate user registrations with Gmail variations
- Easy integration with Laravel's validation system
- Configurable for custom domains and email column names
- Works with Laravel's Eloquent models via a simple trait
Installation
You can install the package via composer:
After installation, you can use the package's install command:
Configuration
After publishing the configuration, you can modify the settings in config/gmail-unique.php
:
Usage
Using the Trait
The simplest way to use this package is by adding the HasNormalizedEmail
trait to your User model:
With this trait, your model will automatically:
- Normalize Gmail addresses during validation
- Prevent saving duplicate Gmail addresses with different dot variations or plus aliases
- Allow users to update their own email with different variations of the same normalized address
Using the Facade
This package also provides a Facade for easier access to the Gmail Unique functionality:
Using the Service
If you need more control, you can use the GmailUniqueService
directly:
Custom Validation Rules
You can also use the service in custom validation rules:
Testing
The package includes comprehensive tests. You can run them with:
License
The MIT License (MIT). Please see License File for more information.
Contributing
Contributions are welcome! Please create issues or pull requests on the GitHub repository.
All versions of laravel-gmail-unique with dependencies
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/console Version ^10.0|^11.0|^12.0