Application-level defender against blocked entities such as IP, email, ...
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src/Guard
tests
.codeclimate.yml
.gitignore
.scrutinizer.yml
.travis.yml
LICENSE
README.md
composer.json
composer.lock
phpmd.xml
phpunit.xml

README.md

Guard

Build Status Maintainability Test Coverage

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');