PHPackages                             phluent/phluent - 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. phluent/phluent

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

phluent/phluent
===============

A fluent assertion library for PHPUnit. Make your tests read the same way you speak.

0.5.3(1y ago)2135MITPHP

Since Aug 2Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Haberkamp/phluent)[ Packagist](https://packagist.org/packages/phluent/phluent)[ RSS](/packages/phluent-phluent/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (17)Used By (0)

📦 Phluent
=========

[](#-phluent)

Make your tests read the same way you speak.

🌟 Highlights
------------

[](#-highlights)

- Write your tests in the same way you speak
- Makes tests easier to understand
- Improves collaboration and communication

ℹ️ Overview
-----------

[](#ℹ️-overview)

Phluent is an assertion library for PHPUnit. It's API design mimics how we speak as humans, this way it's easier for you and your team members to understand what the test is doing.

Compare the two assertions below, the first is using PHPUnit's Assert class and the other example uses Phluent.

```
self::assertToBeGreaterThan(4, 3)
```

```
Expect(4)->toBeGreaterThan(3);
```

The latter example is much easier to read and understand.

### ✍️ Authors

[](#️-authors)

Hello, I'm Nils Haberkamp. I strongly believe that writing better tests makes one a better developer, leads to better communication and collaboration and overall a better software. This package is my take on creating better tests.

🚀 Usage
-------

[](#-usage)

```
use PHPUnit\Framework\TestCase;
use function Phluent\Expect;

class SomeTest extends TestCase {
    public function test_one_plus_one_equals_two(): void
    {
        $result = 1 + 1;

        Expect($result)->toBe(2);
    }
}
```

Available assertions- toBeEmpty
- toBe
- toBeAnInteger
- toBeNegative
- toBeInBetween
- toBePositive
- toBeGreaterThan
- toBeLessThan
- toBeAFloat
- toBeLessThanOrEqual
- toBeGreaterThanOrEqual
- toBeAString
- toBeEmpty
- toStartWith
- toEndWith
- toBeABoolean
- toBeAnArray
- toBeInstanceOf
- toBeNull
- toBeFalse
- toBeTrue
- toContainAllOf
- toContainAnyOf
- toContain
- toHaveALengthOf
- toThrow
    - withMessage
- toHaveThrown
    - withMessage

⬇️ Installation
---------------

[](#️-installation)

First, install the package via composer:

```
composer require --dev phluent/phluent
```

Now you need to include phluent in your autoloader. To do this open the file that bootstraps PHPUnit. (This file is often located under: `tests/bootstrap.php`) Open the file and add the following code:

```
require dirname(__DIR__) . '/vendor/phluent/phluent/src/Expect.php';
require dirname(__DIR__) . '/vendor/phluent/phluent/src/Act.php';
```

The installation is now complete, and you're all set.

Requirements:

- PHP 7.4 or higher
- PHPUnit 9.0 or higher

💭 Feedback and Contributing
---------------------------

[](#-feedback-and-contributing)

Thank you for taking an interest in contributing to this project. Feel free to open an [issue](https://github.com/Haberkamp/phluent/issues/new)or a pull request if you have any suggestions or improvements.

🏅 Thank you
-----------

[](#-thank-you)

I want to thank the people who contributed to the following projects. Without them, this project would not exist.

- [Fluent Assertions](https://github.com/fluentassertions/fluentassertions)
- [jest-extended](https://github.com/jest-community/jest-extended)
- [expect-more-jest](https://github.com/JamieMason/expect-more/tree/master/packages/expect-more-jest)

Special thanks to the maintainers and contributors of [PHPUnit](https://github.com/sebastianbergmann/phpunit)for creating such an awesome project.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 99.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

15

Last Release

636d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2505414eaca742ee34cbdca744a3ff2438b07230f91ca580f7a5b4eaf0d6a71d?d=identicon)[Haberkamp](/maintainers/Haberkamp)

---

Top Contributors

[![Haberkamp](https://avatars.githubusercontent.com/u/35109813?v=4)](https://github.com/Haberkamp "Haberkamp (220 commits)")[![philipp-doblhofer](https://avatars.githubusercontent.com/u/6283313?v=4)](https://github.com/philipp-doblhofer "philipp-doblhofer (1 commits)")

---

Tags

assertionsfluentphpphpunittesting

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/phluent-phluent/health.svg)

```
[![Health](https://phpackages.com/badges/phluent-phluent/health.svg)](https://phpackages.com/packages/phluent-phluent)
```

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[vimeo/psalm

A static analysis tool for finding errors in PHP applications

5.8k77.5M6.7k](/packages/vimeo-psalm)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k96.9M570](/packages/beberlei-assert)[mikey179/vfsstream

Virtual file system to mock the real file system in unit tests.

1.4k108.0M2.7k](/packages/mikey179-vfsstream)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
