Laravel Surveillance

News

October 9th, 2020

screen-monitoring-featured.png

Laravel Surveillance is a package by Neelkanth Kaushik to put malicious users, IP addresses, and anonymous browser fingerprints under surveillance. Once a user is under supervision, this package logs the URLs they visit and even blocks users deemed malicious.

This package consists of a CLI to manage surveillance and a PHP API to survey users programmatically.

Here’s a few CLI examples of what this package can do:

1# Survey ip, user id, browser fingerprints
2php artisan surveillance:enable ip 192.1.2.4
3php artisan surveillance:enable userid 1234
4php artisan surveillance:enable fingerprint hjP0tLyIUy7SXaSY6gyb
5 
6# Block IP, user id, etc.
7php artisan surveillance:block ip 192.1.2.4
8php artisan surveillance:block userid 1234
9php artisan surveillance:block fingerprint hjP0tLyIUy7SXaSY6gyb

Using the package’s PHP API, you can do the same things programmatically:

1use Neelkanth\Laravel\Surveillance\Services\Surveillance;
2 
3// Enable IP surveillance
4Surveillance::manager()
5 ->type("ip")
6 ->value("192.5.4.1")
7 ->enableSurveillance();
8 
9// Block User
10Surveillance::manager()
11 ->type("userid")
12 ->value(2121)
13 ->blockAccess();

You can learn more about this package, get full installation instructions, and view the source code on GitHub at neelkanthk/laravel-surveillance.

Filed in:

Paul Redmond

Full stack web developer. Author of Lumen Programming Guide and Docker for PHP Developers.

ooter>