Download the PHP package climactic/laravel-spam without Composer
On this page you can find all versions of the php package climactic/laravel-spam. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download climactic/laravel-spam
More information about climactic/laravel-spam
Files in climactic/laravel-spam
Package laravel-spam
Short Description Anti-spam protection for Laravel: disposable-email and blocklist rules, StopForumSpam lookups, middleware, and a check API.
License MIT
Homepage https://github.com/climactic/laravel-spam
Informations about the package laravel-spam
# Laravel Spam
A pragmatic anti-spam toolkit for Laravel applications. Block disposable and throwaway email signups, reject known bad actors via StopForumSpam, and configure your own allow/blocklists โ with validation rules, middleware, and a check API.
[](https://discord.gg/kedWdzwwR5)
[](https://packagist.org/packages/climactic/laravel-spam)
[](https://github.com/climactic/laravel-spam/actions?query=workflow%3Arun-tests+branch%3Amain)
[](https://github.com/climactic/laravel-spam/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain)
[](https://packagist.org/packages/climactic/laravel-spam)
[](https://github.com/sponsors/climactic)
[](https://ko-fi.com/ClimacticCo)
๐ Table of Contents
- Laravel Spam
- ๐ Table of Contents
- Features
- ๐ Sponsors
- ๐ฆ Installation
- โ๏ธ Configuration
- ๐ Usage
- The
Spam::check()API - Validation rules
- Route middleware
- Individual rules
- ๐ Keeping the disposable list fresh
- ๐ API Reference
- Facade methods
- Validation rules
- Middleware
- Console
- ๐งช Testing
- ๐ Changelog
- ๐ค Contributing
- ๐ Security Vulnerabilities
- ๐ Support This Project
- โญ Star History
- ๐ฆ Other Packages
- ๐ License
- โ๏ธ Disclaimer
Features
- ๐ซ Block disposable / throwaway email providers (bundled list of 70k+ domains)
- ๐ StopForumSpam lookups with caching and a fail-open default
- ๐ Configurable blocklists for domains and TLDs
- โ
Drop-in validation rules for any
FormRequestorValidator::make()call - ๐ก๏ธ Route middleware for protecting any endpoint that accepts an email
- ๐ A single
Spam::check()API that returns a typed reason - ๐ Artisan command to refresh the disposable-email list from upstream
- ๐งช Zero database tables, zero external auth, zero required API keys
๐ Sponsors
Your logo here โ Become a sponsor and get your logo featured in this README and on our website.
Interested in title sponsorship? Contact us at [email protected] for premium placement and recognition.
๐ฆ Installation
You can install the package via composer:
Optionally publish the config file:
Optionally publish the bundled disposable-email list to local storage (only needed if you plan to refresh it yourself โ see below):
โ๏ธ Configuration
The config file lives at config/spam.php. Every option is documented inline:
Everything is env-driven, so you can tune the package from .env without publishing the config:
No API key required โ StopForumSpam lookups are anonymous and this package does not submit reports.
๐ Usage
The Spam::check() API
Get a structured verdict for any email:
SpamReason cases: Clean, InvalidEmail, BlockedDomain, BlockedTld, Disposable, StopForumSpam.
Convenience predicates:
Validation rules
Use Spam::emailRules() in any FormRequest or inline validator. It returns Laravel's standard email rules plus the three spam rules โ append your own extras (like unique:) as needed:
Or drop it into an inline validator:
Route middleware
Protect any endpoint that accepts an email field with the spam.email middleware alias. A flagged email yields a standard 422 validation response.
If no parameter is passed, the middleware reads config('spam.default_field') (default: email).
Individual rules
If you want to reach for a specific rule directly:
๐ Keeping the disposable list fresh
The package ships with a snapshot of disposable/disposable-email-domains. To refresh from upstream on your own schedule, run:
The command writes to config('spam.disposable.storage_path') (default: storage/app/laravel-spam/disposable-domains.json) and clears the cache. Recommended: schedule it monthly:
๐ API Reference
Facade methods
| Method | Description |
|---|---|
Spam::check(string $email): SpamResult |
Full check; returns {isSpam, reason} |
Spam::isSpamEmail(string $email): bool |
True if any signal fires |
Spam::isDisposable(string $email): bool |
True if the domain is in the disposable list |
Spam::isBlockedDomain(string $email): bool |
True if the domain or TLD is blocklisted |
Spam::isStopForumSpam(string $email): bool |
True if StopForumSpam flags the email |
Spam::emailRules(array $extra = []): array |
Email validation rules; append extras |
Validation rules
| Rule | Class |
|---|---|
| Blocked domain / TLD | Climactic\Spam\Rules\BlockedEmailDomain |
| Disposable email | Climactic\Spam\Rules\DisposableEmail |
| StopForumSpam lookup | Climactic\Spam\Rules\StopForumSpamEmail |
Middleware
| Alias | Class | Parameter |
|---|---|---|
spam.email |
Climactic\Spam\Http\Middleware\BlockSpamEmails |
Request field (defaults to config) |
Console
| Command | Description |
|---|---|
spam:update |
Refresh the disposable-email list |
๐งช Testing
๐ Changelog
Please see CHANGELOG for more information on what has changed recently.
๐ค Contributing
Please see CONTRIBUTING for details. You can also join our Discord server to discuss ideas and get help: Discord Invite.
๐ Security Vulnerabilities
Please report security vulnerabilities to [email protected].
๐ Support This Project
Laravel Spam is free and open source, built and maintained with care. If this package has saved you development time or helped power your application, please consider supporting its continued development.
โญ Star History
๐ฆ Other Packages
Other open-source Laravel packages from Climactic:
| Package | Description |
|---|---|
| climactic/laravel-credits | Ledger-based credit system for virtual currencies, reward points, and credit-based features. |
| climactic/laravel-polar | Seamless Polar.sh integration for subscriptions, payments, and webhooks. |
| climactic/laravel-altcha | Drop-in ALTCHA proof-of-work spam protection โ privacy-first, self-hosted, no third-party services. |
๐ License
The MIT License (MIT). Please see License File for more information.
โ๏ธ Disclaimer
This package is not affiliated with Laravel. It's for Laravel but is not by Laravel. Laravel is a trademark of Taylor Otwell. Disposable-domain data is sourced from the disposable/disposable-email-domains community project.
All versions of laravel-spam with dependencies
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^11.0||^12.0||^13.0