The free Laravel package to help you filter your users ip with multiple services
- Perform a powerful checking for user ip before approving registration or invoice making.
- Parse result from validator
- Example use case
- Get information from ip-api.com
- Check blacklist from barracudacentral, getipintel, easydmarc, valli, uceprotect, projecthoneypot, team-cymru, fortiguard, talosintelligence, scamalytics
- Check quality and e-commerce fraud from maxmind, apivoid, ipqualityscore, cleantalk, iphub
- Easy to validate with a simple line code
- PHP: 8.1 or higher
- Laravel 9.0 or higher
If you prefer to install this package into your own Laravel application, please follow the installation steps below
https://laravel.com/docs/installation
composer require funnydevjsc/laravel-ip-filterphp artisan vendor:publish --provider="FunnyDev\IpFilter\IpFilterServiceProvider" --tag="ip-filter"If publishing files fails, please create corresponding files at the path config/ip-filter.php and app\Http\Controllers\IpFilterControllers.php from this package. And you can also further customize the IpFilterControllers.php file to suit your project.
After publishing the package assets a configuration file will be located at config/ip-filter.php.
<?php
namespace App\Console\Commands;
use FunnyDev\IpFilter\IpFilterSdk;
use Illuminate\Console\Command;
class IpFilterTestCommand extends Command
{
protected $signature = 'ip-filter:test';
protected $description = 'Test Ip Filter SDK';
public function __construct()
{
parent::__construct();
}
public function handle()
{
$instance = new IpFilterSdk();
// Perform checking with fast mode turned on and only use $result['recommended'] as signal (true/false)
$result = $instance->validate(ip: '127.0.0.1', fast: true, score: false);
// Perform a full checking
$result = $instance->validate(ip: '127.0.0.1', fast: false, score: true);
// Explanation of results (structure returned by the SDK)
$result = [
'query' => '127.0.0.1',
'recommend' => true, // Whether to accept this IP
'reason' => '', // Reason when not recommended
'trustable' => [
'mobile' => false,
'proxy' => false,
'hosting' => false,
'botnet' => false,
'total_server' => 0, // Number of blacklist engines checked
'blacklist' => 0, // Percent of blacklists detected (0-100)
'fraud_score' => 0, // Fraud score (0-100)
'reputation' => 'Unknown',
'spam_ip' => false,
],
'location' => [
'country' => 'Unknown',
'countryCode' => 'Unknown',
'region' => 'Unknown',
'regionName' => 'Unknown',
'city' => 'Unknown',
'zip' => 'Unknown',
'lat' => 'Unknown',
'lon' => 'Unknown',
'timezone' => 'Unknown',
],
'dns' => [
'isp' => 'Unknown',
'org' => 'Unknown',
'as' => 'Unknown',
'asname' => 'Unknown',
],
];
}
}Respect us in the Laravel Việt Nam
Please see CONTRIBUTING for details.
If you discover any security-related issues, please ip contact@funnydev.vn or use the issue tracker.
The MIT License (MIT). Please see License File for more information.