Jev directory
CommunityJev Integrations & Adapters
Laravel AI Spam Detector
Opt-in Laravel route middleware and validation rules that classify requests for spam and prompt injection through Laravel AI and TypeSafe Jev. Ships the ValidateRequestWithAi middleware, two field rules, observation mode, and classification events.
- Reading time
- 2 min
- Published by
- Community
- Added
- Nov 23, 2026
Highlights
- Opt-in Laravel route middleware and validation rules for spam and prompt injection detection
- ValidateRequestWithAi checks request bodies and headers for both categories in one call
- Flagged middleware requests return an empty HTTP 200 and the handler is not called
- Requires PHP 8.4+ and Laravel 12 or 13, with Laravel AI ^1.1 installed as a dependency
- Observation mode keeps classification and events active while letting flagged submissions through
Questions about this entry
Short answers drawn from the linked project or page.
Run composer require digifactory/laravel-ai-spam-detector. No custom Composer repository is required, Composer installs a tagged release with default stable minimum stability, and Laravel auto-discovers the service provider.
The package requires PHP 8.4+ and Laravel 12 or 13. Laravel AI ^1.1 is a required runtime dependency in composer.json, so Composer installs it together with the package and no separate installation step is needed.
Yes. Configure TYPESAFE_API_KEY in the application environment, since Laravel AI's Typesafe provider reads that key. The package also exposes AI_SPAM_DETECTOR_ENABLED and AI_SPAM_DETECTOR_OBSERVE environment flags.
The ValidateRequestWithAi middleware returns an empty HTTP 200 response and the route handler is not called. The two validation rules instead produce a normal Laravel validation error for the individual text field being checked.
No. Observation mode keeps classification and events active while allowing AI-flagged submissions through, but the package does not provide a dashboard and does not store results automatically. Register event listeners if you want logs or metrics.
Yes. Publish the configuration with php artisan vendor:publish --tag=ai-spam-detector-config, then use the criteria replace and append keys for spam and prompt_injection, plus profiles, to adjust classification behavior.
No database migration is needed. Upgrade with composer require "digifactory/laravel-ai-spam-detector:^1.0" --with-all-dependencies, merge the new observe, criteria, and profiles keys into your published config, and rebuild cached configuration.
Reactions & coverage
Posts, threads, and videos about this entry from around the web.
YouTube: Kubernetes admission control with a decision model, fail-closed.
Hacker News: SafeDep Gryph plus Jev checks for compromised coding-agent behavior.
2 pointsDetecting Compromised AI Coding Agents with Jev and GryphRead the thread on Hacker NewsX: Jev and Laya on security queries
X: Testing Jev for prompt injection
From the Jev guides
Original write-ups on what this entry is for.
From the Jev AI model community
Posts from builders shipping with Jev right now.