PHPackages                             microunit/microunit - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. microunit/microunit

ActiveLibrary[Testing &amp; Quality](/categories/testing)

microunit/microunit
===================

Minimal. Modern. Mighty. The next-generation PHP unit testing framework for developers who want speed, clarity, and power.

v1.0.0-beta.6(5mo ago)84[6 issues](https://github.com/mitarnik04/MicroUnit/issues)Apache-2.0PHPPHP ^8.0CI passing

Since Jun 17Pushed 4mo agoCompare

[ Source](https://github.com/mitarnik04/MicroUnit)[ Packagist](https://packagist.org/packages/microunit/microunit)[ Fund](https://www.buymeacoffee.com/mitarnikolic)[ RSS](/packages/microunit-microunit/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)DependenciesVersions (7)Used By (0)

[![MicroUnit Banner](images//microunit_banner_wide.png "MicroUnit")](images//microunit_banner_wide.png)

MicroUnit
=========

[](#microunit)

**Minimal. Modern. Mighty.**
*The next-generation PHP unit testing framework for developers who want speed, clarity, and power.*

See [Full Documentation](https://mitarnik04.github.io/MicroUnit/) for an in-depth explanation on all features provided by MicroUnit.

---

[![License Apache2.0](https://camo.githubusercontent.com/a549a7a30bacba7bfceebdc207a8e86c3f2c02995a2527640dca30048fd2b64e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d417061636865253230322e302d626c75652e737667)](https://opensource.org/licenses/Apache-2.0)[![PHP Version](https://camo.githubusercontent.com/487804500a039aee09e5d93e41b745b4cd68dcc0fdf801e67d26d30b93f83358/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d382e302532422d626c75652e737667)](https://www.php.net/)[![Build Status](https://camo.githubusercontent.com/c27a457659b89ee4f1f80f7995c559dd37f2051bde7167ad25791e5c5c92cc8e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6275696c642d70617373696e672d627269676874677265656e2e737667)](#)[![Beta](https://camo.githubusercontent.com/1651d68ef49a0de0fabf4e2f1059528b04e2a7f0bfdf09fd1ede41a56653fe08/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7374617475732d626574612d79656c6c6f772e737667)](#)[![Sponsor](https://camo.githubusercontent.com/79230fa7492b7fc5c458dd293f477b0b806ad95ba36fcd636c7daf5f018a5c25/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73706f6e736f72732f6d697461726e696b30343f6c6162656c3d53706f6e736f72266c6f676f3d476974487562)](https://github.com/sponsors/mitarnik04)

---

> ⚠️ **MicroUnit is currently in public beta!**
> Features may change and bugs may exist. Feedback is welcome as we prepare for the first stable release.

What is MicroUnit?
------------------

[](#what-is-microunit)

MicroUnit is a modern, high-performance unit testing framework for PHP 8+. It’s designed for developers who want expressive, maintainable tests, without the bloat, legacy baggage, or steep learning curve of traditional frameworks. MicroUnit is code-first, configuration-light, and built for modern PHP projects of any size.

---

Why Choose MicroUnit?
---------------------

[](#why-choose-microunit)

**MicroUnit takes a different approach to unit testing**
It gives developers more freedom to decide how test output is presented and offers multiple ways to write tests, while still providing all the features expected from a modern unit testing framework.

The focus is on simplicity, speed, and a zero-dependency philosophy, without sacrificing functionality.

---

Features
--------

[](#features)

### 🚀 Ultra-Fast Test Discovery &amp; Execution

[](#-ultra-fast-test-discovery--execution)

MicroUnit recursively scans your test directories and runs your tests with minimal startup time. No slow autoloaders or heavy configuration.

### 🧪 Expressive, Fluent Assertions

[](#-expressive-fluent-assertions)

The fluent assertion library is designed to be both powerful and readable. Write assertions that make your intent clear, with detailed error reporting and type safety. Whether you’re testing values, arrays, or objects, MicroUnit’s assertions have you covered.

### 🧙‍♂️ Built-in Mocking

[](#‍️-built-in-mocking)

No need for third-party libraries, plugins or complicated setup.
Create mocks, stubs, and spies with a simple, intuitive API. Define return values, throw exceptions, and verify interactions.

### 📝 Flexible Output Writers

[](#-flexible-output-writers)

Choose from minimal, detailed, or file-based reporters out of the box. **You can configure multiple test writers at once** for example, outputting results to the console and saving them to a file simultaneously. This makes it easy to tailor your reporting for both local development and CI/CD pipelines.

**Want even more control?**
MicroUnit is fully extensible: **You can write your own custom test writers** to output results in any format you need (HTML, JSON, Slack notifications, dashboards, etc.).

### 🔧 Simple, Code-First Configuration

[](#-simple-code-first-configuration)

Forget about XML, JSON or YAML. Configure everything entirely in PHP, making your setup explicit, versionable, and easy to understand with no hidden magic.

### 🛠️ Setup &amp; Teardown

[](#️-setup--teardown)

Per-suite and per-test setup/teardown hooks. Pass setup results directly to your tests.

### 📦 Zero-Dependency, Composer-Friendly

[](#-zero-dependency-composer-friendly)

Install with Composer and get started in seconds.

---

Requirements
------------

[](#requirements)

- **PHP 8.0 or higher**
- Composer

---

Getting Started
---------------

[](#getting-started)

### 1. Install

[](#1-install)

```
composer require --dev microunit/microunit
```

### 2. Configure

[](#2-configure)

Create `microunit.config.php` in your current working directory or any parent directories.

See [Configuration](https://mitarnik04.github.io/MicroUnit/configuration) for a full list of configuration options

> Note: All paths are going to be resolved relative to the location of your config file.

```
