PHP code example of abuseipdb / laravel

1. Go to this page and download the library: Download abuseipdb/laravel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

abuseipdb / laravel example snippets


AbuseIPDB::check('127.0.0.1');

AbuseIPDB::report('127.0.0.1', categories: [18, 22]);

AbuseIPDB::reports('127.0.0.1');

AbuseIPDB::blacklist();

AbuseIPDB::checkBlock('127.0.0.1/28');

AbuseIPDB::bulkReport('bulk-report.csv');

AbuseIPDB::clearAddress('127.0.0.1');



namespace App\Exceptions;

use AbuseIPDB\AbuseIPDBExceptionReporter;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException;
use Throwable;

class Handler extends ExceptionHandler
{

    // ...
 
    public function register(): void
    {
        $this->stopIgnoring(SuspiciousOperationException::class);
    
        $this->reportable(function (Throwable $e) {
            if ($e instanceof SuspiciousOperationException) {
                AbuseIPDBExceptionReporter::reportSuspiciousOperationException();
            }
        });
    }
}