isometriks/spam-bundle
Symfony bundle to reduce spam on forms with simple protections like timed submission (min/max seconds between render and submit) and honeypot fields. Easy Composer install, configurable defaults, and per-form options to enable or override settings.
FormType extensions, and configuration hierarchy. This makes it a seamless fit for Symfony applications but non-portable to Laravel without significant refactoring.AbstractType, requiring zero changes to existing form classes beyond option toggles.Symfony\Component\Form, EventDispatcher, and Translation—no direct Laravel equivalents.FormRequest/Validator lacks Symfony’s FormEvent listeners, making timed validation impossible without a rewrite.FormType with Laravel’s FormRequest middleware.| Risk Area | Symfony | Laravel |
|---|---|---|
| Integration Complexity | Low (drop-in) | High (requires custom wrapper) |
| Version Lock-In | Medium (Symfony 3–7) | High (PHP 7.4+ only) |
| False Positives | Medium (timed delays) | N/A (not applicable) |
| Performance Overhead | Low (timestamp storage) | N/A |
| Frontend Dependencies | Medium (honeypot CSS) | High (requires JS/CSS polyfills) |
| Testing Effort | Low (Symfony’s testing tools) | High (mock Laravel’s request lifecycle) |
min values (e.g., 30s) may increase bounce rates for legitimate users.form->createView() on refresh.)min/max timing for our user base? (Benchmark with A/B testing.)spatie/laravel-honeypot)?FormEvent in Laravel tests?throttle middleware?| Component | Symfony Fit | Laravel Fit |
|---|---|---|
| Form Integration | Native (FormType extension) |
Poor (requires middleware/validation) |
| Event System | Native (FormEvent listeners) |
Poor (no direct equivalent) |
| Configuration | Native (YAML/parameters) | Poor (would need custom config loader) |
| Translation | Native (TranslatorInterface) |
Poor (Laravel’s translator is different) |
| Frontend (Honeypot) | CSS/JS agnostic | Requires Laravel Mix/Vite setup |
| Timing Logic | Session-based (Symfony’s Session) |
Stateless (Laravel’s middleware) |
composer require isometriks/spam-bundle
// config/bundles.php
Isometriks\Bundle\SpamBundle\IsometriksSpamBundle::class => ['all' => true],
config/packages/isometriks_spam.yaml:
isometriks_spam:
timed:
min: 7 # seconds
global: true
honeypot:
field: "website" # Unlikely field name
hide_class: "sr-only" # Accessibility-friendly
FormType:
$builder->add('email', EmailType::class, [
'honeypot' => true,
'timed_spam_min' => 3,
]);
{% if form.vars.errors is not empty %}
{{ form_errors(form) }}
{% endif %}
FormType options.DateTime).spatie/laravel-honeypot (honeypot only).spam-protector (rate limiting).created_at in session).FormRequest validator to replace Symfony’s FormEvent.min/max timing and honeypot field names.display: none + aria-hidden).event-dispatcher may clash with Laravel’s containerHow can I help you explore Laravel packages today?