PHPackages                             guard/guard - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. guard/guard

ActiveLibrary

guard/guard
===========

Application-level defender against blocked entities such as IP, email, ...

v1.3(7y ago)2401[1 PRs](https://github.com/iranianpep/guard/pulls)MITPHPPHP &gt;=7

Since Aug 29Pushed 6y ago1 watchersCompare

[ Source](https://github.com/iranianpep/guard)[ Packagist](https://packagist.org/packages/guard/guard)[ Docs](https://github.com/iranianpep/guard)[ RSS](/packages/guard-guard/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (4)Dependencies (2)Versions (7)Used By (0)

Guard
=====

[](#guard)

[![Build Status](https://camo.githubusercontent.com/96018441aa02eba0c16805adc277f13943d6448a871b86ccbfbee744bf7b81dc/68747470733a2f2f7472617669732d63692e6f72672f6972616e69616e7065702f67756172642e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/iranianpep/guard)[![Maintainability](https://camo.githubusercontent.com/b2a73d2049a67585ebda09c2c977f5053f1baf9d7a96e2bedb1ab1f286089249/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f65343630643533623265633039373634346434642f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/iranianpep/guard/maintainability)[![Test Coverage](https://camo.githubusercontent.com/2217ba19ac3b873d4f6383f61940fc061b35012108dc93ee36a5d09e30035cce/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f65343630643533623265633039373634346434642f746573745f636f766572616765)](https://codeclimate.com/github/iranianpep/guard/test_coverage)

Application-level defender against blocked entities such as IP, email, ...

Requirements
------------

[](#requirements)

- PHP &gt;= 7.0.0

Usage
-----

[](#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');

```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 97.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~6 days

Total

4

Last Release

2796d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c4e337f9891a92e469bd236f9774b8c6a894b05a31fc4f3d2da1f4010977b44e?d=identicon)[ehsan.abb](/maintainers/ehsan.abb)

---

Top Contributors

[![iranianpep](https://avatars.githubusercontent.com/u/3667439?v=4)](https://github.com/iranianpep "iranianpep (47 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/guard-guard/health.svg)

```
[![Health](https://phpackages.com/badges/guard-guard/health.svg)](https://phpackages.com/packages/guard-guard)
```

###  Alternatives

[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k7.2M71](/packages/mongodb-laravel-mongodb)[doctrine/mongodb-odm

PHP Doctrine MongoDB Object Document Mapper (ODM) provides transparent persistence for PHP objects to MongoDB.

1.1k23.3M302](/packages/doctrine-mongodb-odm)[alcaeus/mongo-php-adapter

Adapter to provide ext-mongo interface on top of mongo-php-library

46412.3M73](/packages/alcaeus-mongo-php-adapter)[facile-it/mongodb-bundle

Bundle service integration of official \[mongodb/mongo-php-library\](https://github.com/mongodb/mongo-php-library) driver library

38212.1k1](/packages/facile-it-mongodb-bundle)[league/flysystem-gridfs

20498.3k21](/packages/league-flysystem-gridfs)[emag-tech-labs/messenger-mongo-bundle

A Mongo transport for the Symfony Messenger component

16196.8k](/packages/emag-tech-labs-messenger-mongo-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
