PHPackages                             cfx/pspec - 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. [Framework](/categories/framework)
4. /
5. cfx/pspec

ActiveLibrary[Framework](/categories/framework)

cfx/pspec
=========

PSpec is a Pest plugin for composing multi scenarios tests with a simple API, based on RSpec let

v2.0.0(3mo ago)0588↓92.9%MITPHPPHP ^8.3CI failing

Since Apr 17Pushed 3mo agoCompare

[ Source](https://github.com/coderfoxbrasil/cfx-pspec)[ Packagist](https://packagist.org/packages/cfx/pspec)[ Fund](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=66BYDWAT92N6L)[ GitHub Sponsors](https://github.com/nunomaduro)[ RSS](/packages/cfx-pspec/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (1)Dependencies (6)Versions (5)Used By (0)

PSpec
=====

[](#pspec)

[![Latest Stable Version](https://camo.githubusercontent.com/475d06e9b711797fbd60a5bd04a84d6074c69a7cf0ad0efd9b11e239af83b3d7/687474703a2f2f706f7365722e707567782e6f72672f6366782f70737065632f76)](https://packagist.org/packages/cfx/pspec) [![Total Downloads](https://camo.githubusercontent.com/6b5378013ba53998b6af5582b7e56e9b1ce395d34261383106f9330359addfcb/687474703a2f2f706f7365722e707567782e6f72672f6366782f70737065632f646f776e6c6f616473)](https://packagist.org/packages/cfx/pspec) [![Latest Unstable Version](https://camo.githubusercontent.com/2f1264f714bc48d564b2e7aaf9352d8f503ee496201852afddb3189b75d6da60/687474703a2f2f706f7365722e707567782e6f72672f6366782f70737065632f762f756e737461626c65)](https://packagist.org/packages/cfx/pspec) [![License](https://camo.githubusercontent.com/6ae3c1c5f6b398170a88d75b8704cd46011f8624c12071502a0a6eaf01ee46e7/687474703a2f2f706f7365722e707567782e6f72672f6366782f70737065632f6c6963656e7365)](https://packagist.org/packages/cfx/pspec) [![PHP Version Require](https://camo.githubusercontent.com/ee33974138e269a905c1c90404f4c7117d84e234df269328057400c92b65ef23/687474703a2f2f706f7365722e707567782e6f72672f6366782f70737065632f726571756972652f706870)](https://packagist.org/packages/cfx/pspec)

> PSpec is a Pest plugin for composing multi scenarios tests with a simple API, based on RSpec let.

Important
---------

[](#important)

This plugin requires pest &gt;= 3.5.0

### Install

[](#install)

```
composer require cfx/pspec --dev
```

### Simple usage

[](#simple-usage)

```
use function Cfx\PSpec\context;
use function Cfx\PSpec\expectSubject;
use function Cfx\PSpec\get;
use function Cfx\PSpec\let;
use function Cfx\PSpec\subject;

subject(fn () => User::factory()->create(['is_admin' => get('is_admin')]));

context('when is admin', function () {
  let('is_admin', fn() => true);

  it('returns true', function () {
    expectSubject()->is_admin->toBeTrue();
  });
});

context('when is not admin', function () {
  let('is_admin', fn() => false);

  it('returns false', function () {
    expectSubject()->is_admin->toBeFalse();
  });
});
```

### Higher order testing

[](#higher-order-testing)

```
use function Cfx\PSpec\context;
use function Cfx\PSpec\get;
use function Cfx\PSpec\getSubject;
use function Cfx\PSpec\let;

subject(fn () => get('variable'));

context('when using high order testing', function () {
  let('variable', fn () => 2);

  it('can use high order testing')
    ->expect(getSubject(...))
    ->toEqual(2);
});
```

[more examples](https://github.com/coderfoxbrasil/cfx-pspec/blob/master/tests/Example.php)

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance81

Actively maintained with recent releases

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~236 days

Total

4

Last Release

99d ago

Major Versions

1.0.2 → v2.0.02026-03-26

PHP version history (3 changes)1.0.0PHP ^8.1

1.0.2PHP ^8.2

v2.0.0PHP ^8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/10780132?v=4)[Helio S. Junior](/maintainers/hjJunior)[@hjJunior](https://github.com/hjJunior)

---

Top Contributors

[![milroyfraser](https://avatars.githubusercontent.com/u/3282475?v=4)](https://github.com/milroyfraser "milroyfraser (10 commits)")[![hjJunior](https://avatars.githubusercontent.com/u/10780132?v=4)](https://github.com/hjJunior "hjJunior (8 commits)")[![jradtilbrook](https://avatars.githubusercontent.com/u/6128798?v=4)](https://github.com/jradtilbrook "jradtilbrook (4 commits)")

---

Tags

phpplugintestingunitframeworktestpestBDDlazy-evaluationaaarspecgivenlet

### Embed Badge

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

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

###  Alternatives

[pestphp/pest

The elegant PHP Testing Framework.

11.6k72.2M20.6k](/packages/pestphp-pest)[defstudio/pest-plugin-laravel-expectations

A plugin to add laravel tailored expectations to Pest

99600.5k8](/packages/defstudio-pest-plugin-laravel-expectations)[jonpurvis/lawman

A PestPHP Plugin to help with architecture testing SaloonPHP integrations

4138.2k10](/packages/jonpurvis-lawman)[pestphp/pest-plugin-arch

The Arch plugin for Pest PHP.

4358.2M5.5k](/packages/pestphp-pest-plugin-arch)[pestphp/pest-plugin-browser

Pest plugin to test browser interactions

1343.7M184](/packages/pestphp-pest-plugin-browser)[milroyfraser/pest-plugin-gwt

Given When Then(GWT) Plugin for Pest

10532.6k1](/packages/milroyfraser-pest-plugin-gwt)

PHPackages © 2026

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