PHPackages                             texdc/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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. texdc/guard

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

texdc/guard
===========

assertion library with reusable guard function

v1.0.0(8y ago)03451MITPHPPHP ^7.1

Since Oct 17Pushed 8y agoCompare

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

READMEChangelog (1)Dependencies (6)Versions (2)Used By (1)

guard
=====

[](#guard)

An extension for [beberlei/assert](https://github.com/beberlei/assert) that adds some extra assertions and a factory function to simplify usage.

installation
------------

[](#installation)

```
composer require texdc/guard
```

usage
-----

[](#usage)

```
namespace my\lib;

use function texdc\guard\verify;

function storeRating(int $rating) : void {
    verify($rating)->numericRange(1, 10, 'rating should be from 1 - 10');
    // ...
}

function speak(string $message, ?int $times = null) : void {
    verify($message)->notEmpty('message is required')->length(256, 'message is too long');
    verify($times, 'invalid multiplier')->nullOr()->isModulus(8);
    // ...
}
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

3133d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b00c18dc19530c6fa5cc0cafc053dd9377dace10c90d73182b79f8499d2c26d1?d=identicon)[texdc](/maintainers/texdc)

---

Top Contributors

[![texdc](https://avatars.githubusercontent.com/u/1590605?v=4)](https://github.com/texdc "texdc (1 commits)")

---

Tags

assertguardphp71

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[swaggest/json-schema

High definition PHP structures with JSON-schema based validation

48612.5M73](/packages/swaggest-json-schema)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[ashallendesign/laravel-config-validator

A package for validating your Laravel app's config.

217905.3k5](/packages/ashallendesign-laravel-config-validator)[crazybooot/base64-validation

Laravel validators for base64 encoded files

1341.9M8](/packages/crazybooot-base64-validation)[xemlock/htmlpurifier-html5

HTML5 support for HTML Purifier

1052.9M11](/packages/xemlock-htmlpurifier-html5)

PHPackages © 2026

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