vigstudio/laravel-stopforumspam
Laravel package that integrates StopForumSpam checks into your app to detect and block spammy registrations or requests by IP, email, or username. Includes easy configuration and middleware/validation-friendly helpers for quick spam protection.
SpamDetected) for downstream actions (e.g., logging, CAPTCHA enforcement).| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| API Rate Limits | High | Implement exponential backoff and local caching (TTL: 1–24h). |
| False Positives | Medium | Allow whitelisting via config or DB. |
| API Downtime | Medium | Fallback to local cache or graceful degradation. |
| Data Privacy | Low | Ensure compliance with GDPR/CCPA if storing blocked IPs/emails. |
| Outdated Package | Medium | Fork/maintain if upstream stalls (last release: 2023-02-15). |
StopForumSpamRule::class).RegisterRequest).CheckSpamMiddleware for API routes).SpamDetected for analytics).composer.json constraints).Phase 1: Validation Integration (Low Risk)
.env (API key, thresholds).RegisterRequest or ContactFormRequest:
use Vigstudio\StopForumSpam\Rules\StopForumSpamRule;
public function rules()
{
return [
'email' => ['required', 'email', new StopForumSpamRule],
'ip' => ['required', new StopForumSpamRule(type: 'ip')],
];
}
Phase 2: Caching Layer (Medium Risk)
// config/stopforumspam.php
'cache' => [
'driver' => 'redis',
'ttl' => 86400, // 24h
],
Phase 3: Middleware/API Gateway (High Impact)
CheckSpamMiddleware for /register).public function handle(Request $request, Closure $next)
{
if (StopForumSpam::isSpam($request->ip())) {
abort(403, 'Spam detected');
}
return $next($request);
}
StopForumSpamRule for project-specific logic (e.g., custom thresholds).| Priority | Task | Dependencies |
|---|---|---|
| 1 | Install & Configure | Composer, .env setup |
| 2 | Validate Core Rules | Laravel validation system |
| 3 | Add Caching | Redis/Memcached |
| 4 | Implement Middleware | Route definitions |
| 5 | Extend for Custom Use Cases | Business logic (e.g., whitelists) |
composer.json until stability improves.SpamDetected events).\Log::debug('StopForumSpam API response', ['data' => $response]);
spatie/flysystem-cached-disk) if API is overloaded.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| StopForumSpam API Down | False negatives (spam slips through) | Fallback to cache or allowlist. |
| Cache Stale Data | False positives (legit users blocked) | Short TTL + background refresh. |
| Rate Limit Hit | Service degradation | Exponential backoff + queue retries. |
| Package Abandoned | No updates/bug fixes | Fork or migrate to alternative (e.g., spamhaus/laravel). |
README.md for devs:
.env.RegisterRequest).allowlist).StopForumSpamRule.How can I help you explore Laravel packages today?