PHPackages                             kubinyete/assertation - 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. kubinyete/assertation

ActiveLibrary

kubinyete/assertation
=====================

Provides a Assert class that enables you to valide your data

1.0.4(2y ago)1754—0%13PHP

Since Jan 9Pushed 2y ago1 watchersCompare

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

READMEChangelog (10)Dependencies (2)Versions (12)Used By (3)

Assertation
===========

[](#assertation)

Assertation is a free and simple to use validation library, it's built to allow a more expressive syntax while applying data validation and mantaining an assert-oriented approach.

Getting started
===============

[](#getting-started)

To get started, please use our own package directly with Composer:

```
composer require kubinyete/assertation
```

Usage
=====

[](#usage)

First of all, we can start understanding the objective of this approach by looking at some examples and comparisons, below are some equivalent validations with and without `assertation`.

```
$data = '   Spaced   text   ';

// This validation:
$validated = ($data = trim($data)) && strlen($data) > 2;

if (!$validated) {
    throw new UnexpectedValueException('Data is required with at least 2 characters');
}

// Is equivalent to:
$data = Assert::value($data)->asTrim()->lgt(2)->validate()->get();

// And also equivalent to:
$data = Assert::value($data)->rules('asTrim;lgt,2')->get();
```

The following examples are a more complex validation, for simple ones it's easier to do natively, but when our validation rules become more complex, `assertation` can easily validate and modify our data in a more expressive way.

```
$data = Assert::value($data)->rules('null|str;asTrim;asUppercase;asTruncate,100;lgt,1')->get();
// Data can either be null or a string that has a minimum of 1 character and has every character in uppercase
// while limiting the maximum size to 100 characters with a ellipsis cutoff.

$data = Assert::value($data)->rules('null|float|asDecimal')->get();
// Data can either be null, a float or a string with a decimal number (Ex: 123.23).

$data = Assert::value($data)->null()->or()->asUppercase()->asTrim()->in(['HELLO', 'WORLD'])->get();
// Data can either be null or be 'hello' or 'world' with case insensitivity, resulting only in a upper case result.
```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90.5% 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 ~35 days

Recently: every ~86 days

Total

11

Last Release

869d ago

Major Versions

0.2.0 → 1.0.02023-01-12

### Community

Maintainers

![](https://www.gravatar.com/avatar/4d9da6d81de7ebab59b0b9bda2a84521bc2300856c72c896bc63bd800ed099dd?d=identicon)[vitorkubinyete](/maintainers/vitorkubinyete)

---

Top Contributors

[![Kubinyete](https://avatars.githubusercontent.com/u/23388918?v=4)](https://github.com/Kubinyete "Kubinyete (19 commits)")[![jhernandes](https://avatars.githubusercontent.com/u/6430761?v=4)](https://github.com/jhernandes "jhernandes (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

PHPackages © 2026

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