guard / guard
Application-level defender against blocked entities such as IP, email, ...
v1.3
2018-09-18 06:42 UTC
Requires
- php: >=7
- mongodb/mongodb: ^1.4
Requires (Dev)
- phpunit/phpunit: ^6
This package is auto-updated.
Last update: 2024-04-10 07:24:54 UTC
README
Application-level defender against blocked entities such as IP, email, ...
Requirements
- PHP >= 7.0.0
Usage
- Install via composer:
composer require guard/guard
- To block an entity for example an IP:
$guard = new Guard();
// instantiate a mongoDB driver
$mongoDriver = new MongoDBDriver(new Client(), 'test_db', 'test_collection');
// push the mongoDB driver to the guard object - at the moment mongoDB is the only available driver
$guard->pushDriver($mongoDriver);
// block an IP
$guard->block('ip', '127.0.0.1');
- To check an entity for example an IP is blocked:
if ($guard->isBlock('ip', '127.0.0.1') === true) {
// ip 127.0.0.1 is blocked
}
- To unblock an entity for example an IP:
$guard->unBlock('ip', '127.0.0.1');