Download the PHP package teikun-86/anti-spoof without Composer
On this page you can find all versions of the php package teikun-86/anti-spoof. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download teikun-86/anti-spoof
More information about teikun-86/anti-spoof
Files in teikun-86/anti-spoof
Package anti-spoof
Short Description Laravel middleware to detect and prevent spoofed IPs, forged headers, and identity manipulation attempts.
License MIT
Informations about the package anti-spoof
AntiSpoof — Laravel Middleware to Detect Request Spoofing
AntiSpoof is a Laravel package that protects your API against spoofed IPs, forged headers, and suspicious User-Agents.
It’s plug-and-play, built with middleware + actions + events, and works beautifully with any Laravel-based API.
Features
- Detect spoofed
X-Forwarded-For
headers - Detect suspicious or blacklisted User-Agents
- Event-driven architecture (customizable responses)
- Fully configurable
Installation
Publish the Config File
To customize the package settings, publish the configuration file:
Configuration
The configuration file is located at config/anti-spoof.php
. You can customize the following settings:
Usage
Middleware
Global Middleware
Register the middleware in your application's route or global middleware stack.
Route Level Middleware
Actions
You can also use the DetectSpoofing
action directly in your controllers or service classes:
Helper Class
AntiSpoof Class
You can use the AntiSpoof
helper class to check for spoofing:
AntiSpoof Facade
You can also use the AntiSpoof
facade for convenience:
Events
You can listen to these in your ServiceProvider or anywhere you like.
Event | Description |
---|---|
Teikun86\AntiSpoof\Events\SpoofAttemptDetected |
Fired when IP spoofing is detected |
Teikun86\AntiSpoof\Events\ShadyUserAgentDetected |
Fired when a blocked UA is detected |
Listening to Events
You can listen to these events in your EventServiceProvider
:
or listen manually in other service providers:
Testing
Publish the test cases:
Then run the artisan command to test:
Contributing
We welcome contributions! Please read our Contributing Guide for details on our code of conduct, and the process for submitting pull requests.
License
Developed by Aziz Febriyanto with passion and paranoia 💀
Security is not a feature — it’s a responsibility.
This package is open-sourced software licensed under the MIT license.
All versions of anti-spoof with dependencies
php Version ^8.1
illuminate/support Version ^10.0|^11.0|^12.0