Hamcrest is a matching library originally written for Java, but subsequently ported to many other languages. hamcrest-php is the PHP port of Hamcrest and essentially follows a literal translation of the original Java API for Hamcrest, with a few Exceptions, mostly down to PHP language barriers. Unless it would be non-semantic for a matcher to do so, hamcrest-php allows dynamic typing for it's input, in "the PHP way". Exception are where semantics surrounding the type itself would suggest otherwise, such as stringContains() and greaterThan(). Several matchers have not been ported because they don't make sense or don't apply in PHP. When most of the collections matchers are finally ported, PHP-specific aliases will probably be created due to a difference in naming conventions between Java's Arrays, Collections, Sets and Maps compared with PHP's Arrays.

Features

  • Hamcrest matchers are easy to use
  • You can use the global proxy-functions
  • The global proxy-functions aren't autoloaded by default
  • A tutorial can be found on the Hamcrest site
  • Evaluate arrays

Project Samples

Project Activity

See All Activity >

Categories

Libraries

License

BSD License

Follow Hamcrest PHP

Hamcrest PHP Web Site

Other Useful Business Software
Go From AI Idea to AI App Fast Icon
Go From AI Idea to AI App Fast

One platform to build, fine-tune, and deploy ML models. No MLOps team required.

Access Gemini 3 and 200+ models. Build chatbots, agents, or custom models with built-in monitoring and scaling.
Try Free
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of Hamcrest PHP!

Additional Project Details

Programming Language

PHP

Related Categories

PHP Libraries

Registered

2021-08-20