Hamcrest-PHP is a powerful and flexible library for PHP developers to write clean and readable unit tests with expressive matchers and assertions.
Current Version: 2.0.1
Last Updated: 2020-07-09
PHP Requirement: ^5.3|^7.0|^8.0
Dependencies: None
Package Description
Hamcrest-PHP is a versatile library designed to streamline unit testing in PHP projects. This library provides a rich set of matchers and assertions, allowing developers to write clear, concise, and maintainable test cases. With Hamcrest-PHP, you can easily create custom matchers, perform complex assertions, and enhance the quality of your test suites.
Make sure to include the correct namespace and class paths for proper usage.
<?php
// Example from PHPlibraries.com
require_once 'libs/hamcrest/hamcrest-php/2.1.1/loader.php';
use Hamcrest\BaseMatcher;
use Hamcrest\Matcher;
$obj = new BaseMatcher();
echo '✅ Test OK: ' . get_class($obj);
?>
We aim to make using PHP packages easier without Composer. If something doesn't work, let us know — we'll fix it promptly.
Community Discussion
Ask questions, share tips, or report issues below.