Skip to content

PHP Unitary is a user-friendly and robust unit testing library designed to make writing and running tests for your PHP code easy.

License

Notifications You must be signed in to change notification settings

MaplePHP/Unitary

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MaplePHP Unitary — Fast Testing, Full Control, Zero Friction

Unitary is a modern PHP testing framework built for developers who want speed, precision, and complete freedom. No config. No noise. Just a clean, purpose-built system that runs 100,000+ tests in a second and scales effortlessly—from quick checks to full-suite validation.

Mocking, validation, and assertions are all built in—ready to use without setup or plugins. The CLI is intuitive, the experience is consistent, and getting started takes seconds. Whether you’re testing one function or an entire system, Unitary helps you move fast and test with confidence.

Prompt demo

Do you like the CLI theme? Download it here

Familiar Syntax. Fast Feedback.

Unitary is designed to feel natural for developers. With clear syntax, built-in validation, and zero setup required, writing tests becomes a smooth part of your daily flow—not a separate chore.

group("Has a about page", function(TestCase $case) {

    $response = $this->get("/about");
    $statusCode = $response->getStatusCode();
    
    $case->validate($statusCode, function(Expect $valid) {
        $valid->isHttpSuccess();
    });
});

Next-Gen PHP Testing Framework

Unitary is a blazing-fast, developer-first testing framework for PHP, built from scratch with zero dependencies on legacy tools like many others. It’s simple to get started, lightning-fast to run, and powerful enough to test everything from units to mocks.

🚀 Test 100,000+ cases in ~1 second. No config. No bloat. Just results.


🔧 Why Use Unitary?

  • Works out of the box – No setup, no config files.
  • Not built on PHPUnit – Unitary is a standalone framework.
  • 100% agnostic – Every sub-library is purpose-built for speed and control.
  • First-class CLI – Intuitive test runner that works across platforms.
  • Powerful validation – Built-in expectation engine, assert support, and structured output.
  • Mocking included – No external mocking libraries needed.
  • Super low memory usage – Ideal for local runs and parallel CI jobs.

⚡ Blazing Fast Performance

Unitary runs large test suites in a fraction of the time — even 100,000+ tests in just 1 second.

🚀 That’s up to 46× faster than the most widely used testing frameworks.

Benchmarks based on real-world test cases. 👉 See full benchmark comparison →


Getting Started (Under 1 Minute)

Set up your first test in three easy steps:

1. Install

composer require --dev maplephp/unitary

You can run unitary globally if preferred with composer global require maplephp/unitary.


2. Create a Test File

Create a file like tests/unitary-request.php. Unitary automatically scans all files prefixed with unitary- (excluding vendor/).

Paste this test boilerplate to get started:

use MaplePHP\Unitary\{Expect,TestCase,Unit};

group("Your test subject", function (TestCase $case) {
    $case->validate("Your test value", function(Expect $valid) {
        $valid->isString();
    });
});

💡 Tip: Run php vendor/bin/unitary --template to auto-generate this boilerplate code above.


3. Run Tests

php vendor/bin/unitary

Need help?

php vendor/bin/unitary --help

The Output:

Prompt demo And that is it! Your tests have been successfully executed!

With that, you are ready to create your own tests!


📅 Latest Release

v1.3.0 – 2025-06-20 This release marks Unitary’s transition from a testing utility to a full framework. With the core in place, expect rapid improvements in upcoming versions.


🧱 Built From the Ground Up

Unitary stands on a solid foundation of years of groundwork. Before Unitary was possible, these independent components were developed:

This full control means everything works together, no patching, no adapters and no guesswork.


Philosophy

Test everything. All the time. Without friction.

TDD becomes natural when your test suite runs in under a second, even with 100,000 cases. No more cherry-picking. No more skipping.


Like The CLI Theme?

That’s DarkBark. Dark, quiet, confident, like a rainy-night synthwave playlist for your CLI.

Download it here


🤝 Contribute

Unitary is still young — your bug reports, feedback, and suggestions are hugely appreciated.

If you like what you see, consider:

  • Reporting issues
  • Sharing feedback
  • Submitting PRs
  • Starring the repo ⭐

📬 Stay in Touch

Follow the full suite of MaplePHP tools:

About

PHP Unitary is a user-friendly and robust unit testing library designed to make writing and running tests for your PHP code easy.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages