https://github.com/maplephp/unitary
Unitary is a modern PHP testing framework for developers who value speed, precision, and full control.
https://github.com/maplephp/unitary
ci-cd code-quality continuous-integration php php-testing tdd testing-library testing-tools unit-testing unit-tests user-friendly validation
Last synced: 7 days ago
JSON representation
Unitary is a modern PHP testing framework for developers who value speed, precision, and full control.
- Host: GitHub
- URL: https://github.com/maplephp/unitary
- Owner: MaplePHP
- License: apache-2.0
- Created: 2024-03-10T19:27:08.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2026-01-13T22:08:10.000Z (9 days ago)
- Last Synced: 2026-01-13T23:59:56.864Z (9 days ago)
- Topics: ci-cd, code-quality, continuous-integration, php, php-testing, tdd, testing-library, testing-tools, unit-testing, unit-tests, user-friendly, validation
- Language: PHP
- Homepage: https://maplephp.github.io/Unitary/
- Size: 1.57 MB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Unitary β Evidence-Driven PHP Testing Framework
Unitary is a modern PHP testing framework for developers who value speed, precision, and full control. No configuration. No clutter. Just a clean, purpose-built core that can execute 100,000+ tests per second and scales smoothly from quick sanity checks to full integration suites.
Mocking, validation, and assertions are built in from the start, with no plugins, adapters, or bootstrapping required. The CLI is fast and intuitive, the workflow is consistent, and getting started takes seconds. Whether you are validating a single function or an entire system, Unitary lets you move quickly and test with confidence.

---
## Documentation
Visit the full documentation at:
π https://maplephp.github.io/Unitary/
---
## 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 and not a separate chore.
```php
use MaplePHP\Unitary\TestCase;
group("Your grouped test subject", function (TestCase $case) {
$json = '{"response":{"status":200,"message":"ok"}}';
$case->expect($json)
->isJson()
->hasJsonValueAt("response.status", 200)
->validate();
});
```
---
## Next-Gen PHP Testing Framework
Unitary is a lightning-fast, developer-first testing framework for PHP, built from the ground up with zero third-party dependencies and a highly optimized core, not just a wrapper around legacy tools.
> π *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.
---
## β‘ Lightning-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 50Γ faster than the most widely used testing frameworks.
---
## Getting Started (Under 1 Minute)
Set up your first test in three easy steps:
### 1. Install
```bash
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:
```php
use MaplePHP\Unitary\{TestCase};
group("HTTP Request", function(TestCase $case) {
$request = new Request("GET", "https://example.com/?id=1&slug=hello");
$case->expect($request->getUri()->getQuery())
->hasQueryParam("id", 1)
->hasQueryParam("slug", "hello")
->validate();
});
```
> π‘ Tip: Run `php vendor/bin/unitary --template` to auto-generate this boilerplate code.
---
### 3. Run Tests
```bash
php vendor/bin/unitary
```
#### Need help?
```bash
php vendor/bin/unitary --help
```
#### The Output:

*And that is it! Your tests have been successfully executed!*
With that, you are ready to create your own tests!
---
## π
Latest Release
**v2.0.0**
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:
* [`maplephp/Emitron`](https://github.com/maplephp/emitron) β PSR-15 kernel and middleware engine
* [`maplephp/http`](https://github.com/maplephp/http) β PSR-7 HTTP messaging and stream handling
* [`maplephp/prompts`](https://github.com/maplephp/prompts) β Interactive prompt/command engine
* [`maplephp/blunder`](https://github.com/maplephp/blunder) β A pretty error handling framework
* [`maplephp/validate`](https://github.com/maplephp/validate) β Type-safe input validation
* [`maplephp/dto`](https://github.com/maplephp/dto) β Strong data transport
* [`maplephp/container`](https://github.com/maplephp/container) β PSR-11 Container, container and DI system
* [`maplephp/cache`](https://github.com/maplephp/cache) β PSR-6 and PSR-16 caching library
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](https://github.com/MaplePHP/DarkBark)
---
## π€ 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:
* [https://github.com/MaplePHP](https://github.com/MaplePHP)