Download the PHP package plin-code/laravel-email-fixer without Composer
On this page you can find all versions of the php package plin-code/laravel-email-fixer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download plin-code/laravel-email-fixer
More information about plin-code/laravel-email-fixer
Files in plin-code/laravel-email-fixer
Package laravel-email-fixer
Short Description Sanitize, normalize and auto-correct malformed email addresses before validation in Laravel
License MIT
Homepage https://github.com/plin-code/laravel-email-fixer
Informations about the package laravel-email-fixer
Laravel Email Fixer
Sanitize, normalize and auto-correct malformed email addresses in Laravel. Handles common typos from web forms, CSV imports, and mobile keyboards, including locale-specific issues like the Italian ò → @ keyboard quirk.
The Problem
Users constantly submit broken email addresses. Typos, missing @ signs, incomplete domains, trailing dots, angle brackets from copy-paste, commas instead of dots. Every registration form, every CSV import, every contact form collects these. Most apps just reject them and lose the user.
Laravel Email Fixer automatically repairs these emails before validation, so your users don't bounce off your forms.
What It Fixes
| Input | Output | Fixer |
|---|---|---|
[email protected] |
[email protected] |
TrimWhitespace |
<[email protected]> |
[email protected] |
StripAngleBrackets |
user@gmail,com |
[email protected] |
CommaToDot |
usergmail.com |
[email protected] |
InsertMissingAt |
user@gmail |
[email protected] |
CompleteDomain |
user@gmailcom |
[email protected] |
FixDomainSeparator |
[email protected] |
[email protected] |
CleanLocalPart |
[email protected]. |
[email protected] |
CleanTrailingDots |
[email protected] |
[email protected] |
Lowercase |
[email protected]§ |
[email protected] |
StripNonAsciiTrailing |
userògmail.com |
[email protected] |
ItalianKeyboard (locale: it) |
Installation
Optionally publish the config file:
Quick Start
Using the Facade
Using the Validation Rule
Apply the SanitizedEmail rule to auto-fix and validate email fields in one step. The fixed value is automatically merged back into the request.
With options:
Using the Middleware
Register the SanitizeEmails middleware to automatically fix all email fields in incoming requests before they reach your controllers.
By default, the middleware targets fields matching these patterns: email, *_email, email_*, *email*. You can customize this in the config file.
Use Cases
Registration and Login Forms
The most common scenario. Users mistype their email on signup, never receive the confirmation, and leave. With Email Fixer, most typos are silently corrected.
CSV/Bulk Import
When importing contacts or users from spreadsheets, email quality is often poor. Use fixMany() to clean them in bulk and diagnose() to flag the ones that could not be repaired.
Italian (or Locale-Specific) Users
Italian keyboards place the ò key right next to the @ key, causing a very common typo. Enable the Italian locale to handle this automatically, along with local domain shortcuts like libero → libero.it.
API Input Sanitization
Use the middleware on your API routes to transparently sanitize emails before any validation or processing takes place.
Auditing and Debugging
Use diagnose() to understand exactly what was changed and why, useful for logging or admin dashboards.
Configuration
The published config file (config/email-fixer.php) allows you to customize:
Custom Fixer Pipeline
You can define your own fixer order or add custom fixers:
Custom fixers must implement PlinCode\LaravelEmailFixer\Contracts\FixerInterface:
Standalone Usage
You can use Email Fixer outside of Laravel:
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Daniele Barbaro
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-email-fixer with dependencies
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^12.0||^13.0
illuminate/support Version ^12.0||^13.0
illuminate/validation Version ^12.0||^13.0
guzzlehttp/promises Version ^2.0