PHPackages                             fusonic/assert - 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. fusonic/assert

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

fusonic/assert
==============

Extends beberlei/assert with a convenient chaining functionality

0.0.2(5mo ago)04.0k↓30.8%MITPHPPHP &gt;=8.2

Since Mar 12Pushed 5mo ago6 watchersCompare

[ Source](https://github.com/fusonic/php-assert)[ Packagist](https://packagist.org/packages/fusonic/assert)[ RSS](/packages/fusonic-assert/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (10)Versions (3)Used By (0)

assert
======

[](#assert)

[![License](https://camo.githubusercontent.com/b15640929598a3b1708a7c6cfbf43b2be3c5b26e108edd50aaf2aae9f3c92099/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6675736f6e69632f6173736572743f636f6c6f723d626c7565)](https://github.com/fusonic/php-assert/blob/master/LICENSE)[![Latest Version](https://camo.githubusercontent.com/5ba2c3861238ed5d19c7ae3c9402e155de126833715b3893e8ad5b3a5d2c6501/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7461672f6675736f6e69632f7068702d6173736572742e7376673f636f6c6f723d626c7565)](https://github.com/fusonic/php-assert/releases)[![Total Downloads](https://camo.githubusercontent.com/aff5096a30352eaa8e39e93ae4e9ecb65c0f27cfb3fbc17f231072c43e591015/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6675736f6e69632f6173736572742e7376673f636f6c6f723d626c7565)](https://packagist.org/packages/fusonic/assert)[![php 8.2+](https://camo.githubusercontent.com/2acc9abf8a0687f1ee2c8f864ea70eb248731b91e8878d481f733ed115157ad1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d6d696e253230382e322d626c75652e737667)](https://github.com/fusonic/php-assert/blob/master/composer.json)

- [About](#about)
- [Install](#install)
- [Usage](#usage)

About
-----

[](#about)

This assertion library extends [beberlei/assert](https://github.com/beberlei/assert) with convenient chaining functionality to improve error message details.

- Wraps all chained and non-chained assertion errors in the same exception object.
- Lazy validation with a defined root path (e.g. an object class name)
- Single assertions with a separate root path as a first argument

Install
-------

[](#install)

Use composer to install the library from packagist.

```
composer require fusonic/assert
```

Usage
-----

[](#usage)

Regular assertion with root path:

```
Assert::that('User', 'username', $username)->notEmpty()->length(10);
```

Chained lazy assertion with root path example:

```
Assert::lazy('User')
    ->that($username, 'username')
        ->notEmpty()
    ->that($password, 'password')
        ->minLength(8)
        ->maxLength(30)
    ->verifyNow();
```

Example output:

```
The following 2 assertions failed:
1) User.username: Value "" is empty, but non empty value was expected.
2) User.password: Value "1123" is too short, it should have at least 8 characters, but only has 4 characters.

```

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance71

Regular maintenance activity

Popularity22

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% 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 ~267 days

Total

2

Last Release

166d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/229567?v=4)[Matthias Burtscher](/maintainers/mburtscher)[@mburtscher](https://github.com/mburtscher)

![](https://avatars.githubusercontent.com/u/338856?v=4)[David Roth](/maintainers/davidroth)[@davidroth](https://github.com/davidroth)

![](https://avatars.githubusercontent.com/u/3588470?v=4)[Arjan Frans](/maintainers/arjanfrans)[@arjanfrans](https://github.com/arjanfrans)

![](https://avatars.githubusercontent.com/u/1465587?v=4)[Michael Zangerle](/maintainers/michaelzangerle)[@michaelzangerle](https://github.com/michaelzangerle)

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

---

Top Contributors

[![arjanfrans](https://avatars.githubusercontent.com/u/3588470?v=4)](https://github.com/arjanfrans "arjanfrans (2 commits)")[![DominicLuidold](https://avatars.githubusercontent.com/u/22751730?v=4)](https://github.com/DominicLuidold "DominicLuidold (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  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)
