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

ActiveLibrary

czproject/assert
================

Assert helper.

v2.0.1(10mo ago)024.8k↓48.2%7BSD-3-ClausePHPPHP 8.0 - 8.4CI passing

Since Sep 9Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/czproject/assert)[ Packagist](https://packagist.org/packages/czproject/assert)[ Fund](https://www.janpecha.cz/donate/)[ RSS](/packages/czproject-assert/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (1)Versions (10)Used By (7)

CzProject\\Assert
=================

[](#czprojectassert)

[![Build Status](https://github.com/czproject/assert/workflows/Build/badge.svg)](https://github.com/czproject/assert/actions)[![Downloads this Month](https://camo.githubusercontent.com/c8a13101141ee83c6f60cdaadd1308f9b15a358c005d9e227c24dadfc98c2f50/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f637a70726f6a6563742f6173736572742e737667)](https://packagist.org/packages/czproject/assert)[![Latest Stable Version](https://camo.githubusercontent.com/e3755ac61b94c75e98436fdda47920bef6fd8c37714e34289f6cfa9b96068e2c/68747470733a2f2f706f7365722e707567782e6f72672f637a70726f6a6563742f6173736572742f762f737461626c65)](https://github.com/czproject/assert/releases)[![License](https://camo.githubusercontent.com/fa7d5fcf2c84b580327af52da95dd751703af65f079dc3c5a0081beac0789718/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4e65772532304253442d626c75652e737667)](https://github.com/czproject/assert/blob/master/license.md)

Assert helper, throws exceptions.

[![Donate](https://camo.githubusercontent.com/101b981194f1dafbf9c42e19c3034fe2d724e75be972cef0f4477074997834db/68747470733a2f2f6275796d65636f666665652e696e746d2e6f72672f696d672f646f6e6174652d62616e6e65722e76312e737667)](https://www.janpecha.cz/donate/)

Installation
------------

[](#installation)

[Download a latest package](https://github.com/czproject/assert/releases) or use [Composer](http://getcomposer.org/):

```
composer require czproject/assert

```

`CzProject\Assert` requires PHP 8.0 or later.

Usage
-----

[](#usage)

```
use CzProject\Assert\Assert;

function add($a, $b)
{
	Assert::int($a);
	Assert::int($b);
	return $a + $b;
}
```

- `assert($value, $msg = NULL)` - checks if value is `TRUE`
- `bool($value, $msg = NULL)` - checks if value is `bool`
- `int($value, $msg = NULL)` - checks if value is `int`
- `intOrNull($value, $msg = NULL)` - checks if value is `int|NULL`
- `float($value, $msg = NULL)` - checks if value is `float`
- `floatOrNull($value, $msg = NULL)` - checks if value is `float|NULL`
- `number($value, $msg = NULL)` - checks if value is `float|int`
- `numberOrNull($value, $msg = NULL)` - checks if value is `float|int|NULL`
- `string($value, $msg = NULL)` - checks if value is `string`
- `stringOrNull($value, $msg = NULL)` - checks if value is `string|NULL`
- `type($value, $type, $msg = NULL)` - checks if value is instance of given type
- `typeOrNull($value, $type, $msg = NULL)` - checks if value is instance of given type or `NULL`
- `null($value, $msg = NULL)` - checks if value is `NULL`
- `in($value, $arr, $msg = NULL)` - checks if value is in array
- `inArray($value, $arr, $msg = NULL)` - alias for `Assert::in()`

PhpStan extension
-----------------

[](#phpstan-extension)

```
services:
	-
		class: CzProject\Assert\Bridges\PhpStan\StaticMethodTypeSpecifyingExtension
		tags:
			- phpstan.typeSpecifier.staticMethodTypeSpecifyingExtension
```

---

License: [New BSD License](license.md)
Author: Jan Pecha,

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance54

Moderate activity, may be stable

Popularity26

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity86

Battle-tested with a long release history

 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

Every ~356 days

Recently: every ~387 days

Total

9

Last Release

321d ago

Major Versions

v1.5.0 → v2.0.02025-06-10

PHP version history (3 changes)v1.0.0PHP &gt;=5.4.0

v1.3.0PHP &gt;=5.6.0

v2.0.0PHP 8.0 - 8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/5c980b1511b4a0350442dc23d89c99d4d9a2411b7e765d52c133ccacf616968b?d=identicon)[janpecha](/maintainers/janpecha)

---

Top Contributors

[![janpecha](https://avatars.githubusercontent.com/u/637719?v=4)](https://github.com/janpecha "janpecha (43 commits)")

---

Tags

assertassertionsphp

### Embed Badge

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

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

PHPackages © 2026

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