FindSoftware

beberlei/assert

PHP library of assertions and guard methods for input validation.

beberlei/assert is a PHP library of assertions and guard methods for checking input. Each assertion, such as Assertion::integer() or Assertion::notEmpty(), throws an exception when the value does not hold, so the code does not need an if-clause for the same condition. The library validates input and does not filter it. A fluent Assert::that() API chains several checks on one value, and lazy assertions collect every failure and throw one combined exception. A project can subclass the assertion class to change the exception it throws and to add its own assertions.

Identity

Status
Active
Maintainer
Benjamin Eberlei4
Maintained by
Individual
First release
20123

Rendering and deploy

Install with
composer require beberlei/assert2

Releases

Current major version
36
Last release
2026-06-107

Adoption

GitHub stars
2,4261
Packagist downloads
110,672,8469
Contributors
698
Dependent repositories
4,62610
Dependent packages
66710

Why these figures do not compare

Sources

  1. 2026-11-04: links, Written in, GitHub stars
    api.github.com/repos/beberlei/assert
  2. 2026-11-04: links, Categories, Install with
    github.com/beberlei/assert/blob/master/README.md
  3. 2026-11-04: First release
    api.github.com/repos/beberlei/assert/tags
  4. 2026-11-04: Maintainer
    github.com/beberlei/assert/blob/master/LICENSE
  5. 2026-11-04: Runtime, Minimum runtime, License
    github.com/beberlei/assert/blob/v3.3.4/composer.json
  6. 2026-11-04: Current major version
    api.github.com/repos/beberlei/assert/releases
  7. 2026-11-04: Last release
    api.github.com/repos/beberlei/assert/releases/latest
  8. 2026-11-04: Contributors
    api.github.com/repos/beberlei/assert/contributors
  9. 2026-11-04: Packagist downloads
    packagist.org/packages/beberlei/assert.json
  10. 2026-11-04: Dependent packages, Dependent repositories
    packages.ecosyste.ms/api/v1/registries/packagist.org/packages/beberlei%2Fassert

Last reviewed · Listed since Edit on GitHubThis page as markdownas JSON