Getting Started


To install the current version of BeBat/Verify from Packagist, run the following in your project directory:

composer require --dev bebat/verify

BeBat/Verify will be added to your composer.json under require-dev and installed in your vendor directory.


BeBat/Verify is built on top of PHPUnit’s own assertions. It is compatible with any version of PHPUnit 8 or 9 and has preliminary support for version 10. It should also be compatible with the current version of Codeception. Some assertions have been removed from later versions of PHPUnit, and others added. When using BeBat/Verify you should explicitly declare what major version of PHPUnit your project depends on so that there are no surprise compatibility issues. See the available assertions to see what assertions are compatible with your version of PHPUnit.

In addition, BeBat/Verify is compatible with both PHP 7.2+ and 8+.

Basic Usage

BeBat/Verify uses namespaced functions, so to include it in your unit tests you should add a use function statement to the top of your test files:

// assertions for code values
use function BeBat\Verify\verify;

// assertions for files
use function BeBat\Verify\verify_file;

To use BeBat/Verify in your tests, pass the subject to verify(), followed by a conjunction, and then your assertion(s). For example:

$testValue = true;


That’s it! You’ve now asserted that $testValue is true!

Alternate Functions

To better match TDD/BDD style, you may wish to give BeBat/Verify’s functions a different name like expect(). This can be done through the use of function aliases like so:

use function BeBat\Verify\verify as expect;
use function BeBat\Verify\verify_file as expect_file;

Now, in your unit test code, you can write:

expect($testValue)->will()->be()->equalTo('some other value');