PHPackages                             acgrid/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. [Testing &amp; Quality](/categories/testing)
4. /
5. acgrid/assert

Abandoned → [beberlei/assert](/?search=beberlei%2Fassert)Library[Testing &amp; Quality](/categories/testing)

acgrid/assert
=============

Thin assertion library for input validation in business models.

v2.6.5.1(9y ago)048BSD-2-ClausePHPPHP &gt;=5.5

Since May 20Pushed 9y ago1 watchersCompare

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

READMEChangelogDependencies (2)Versions (27)Used By (0)

Assert
======

[](#assert)

Travis Status: [![Build Status](https://camo.githubusercontent.com/d70163d30b546f3dd772fb944dbe0d1af3eac7e47133b5cc88e6b55ada50d0c2/68747470733a2f2f7472617669732d63692e6f72672f6163677269642f6173736572742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/acgrid/assert)

**This is a personal forked version. It has been rewritten so that all the components can be overridden in user land.****Also, this fork will ONLY work on PHP 5.5 or above due to class name constants.**

A simple php library which contains assertions and guard methods for input validation (not filtering!) in business-model, libraries and application low-level code. The library can be used to implement pre-/post-conditions on input data.

Idea is to reduce the amount of code for implementing assertions in your model and also simplify the code paths to implement assertions. When assertions fail, an exception is thrown, removing the necessity for if-clauses in your code.

The library is not using Symfony or Zend Validators for a reason: The checks have to be low-level, fast, non-object-oriented code to be used everywhere necessary. Using any of the two libraries requires instantiation of several objects, using a locale component, translations, you name it. Its too much bloat.

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

[](#installation)

Using Composer:

```
composer require acgrid/assert
```

Example usages
--------------

[](#example-usages)

```
