Package

Jasonmccreary Double

A modern PHP double library that puts developer experience first.

Package

jasonmccreary/double

View on GitHub →

Build Status Latest Stable Version License

Double

A modern PHP double library that puts developer experience first.

  • Zero learning curve — create a Double and start testing immediately. No taxonomy to memorize, no upfront decisions about mocks vs. spies vs. partials.
  • Failures for humans — no terse output, no internal class identifiers to decode, just a plain-English next step.
  • One clean API — a handful of methods, no aliases, no hidden nuance. If you can guess the method name, you're probably right.
  • Ready for contribution — small, well-bounded internals mean no reverse-engineering the whole library for your first PR.

Installation

composer require --dev jasonmccreary/double

Usage

$repository = Double::for(BookRepository::class);
$repository->expects('find')->with(123)->returns($book);
 
$service = new CatalogService($repository);
$service->lookup(123);
 
$repository->received('recordView')->with($book);

Documentation

Full docs — creating doubles, modes (Loose/Strict/Passthru), argument matching, verification, failure messages, PHPUnit integration, and contributing — live at testdoublephp.com.

Contributing

Contributions should target the master branch, follow the project's code style, and include tests. See Contributing for the project's standing policies (no aliases, module boundaries, frozen public API) and walkthroughs for adding a matcher or improving a failure message.

Jasonmccreary Double Related Articles

Mock PHP Classes in Tests With the Double Library image

Mock PHP Classes in Tests With the Double Library

Read article
Eloquent Double Entry Accounting with a focus on IFRS Compliant Reporting image

Eloquent Double Entry Accounting with a focus on IFRS Compliant Reporting

Read article
Laravel.io Podcast – #10 Double Colon Pitchforks image

Laravel.io Podcast – #10 Double Colon Pitchforks

Read article
Laravel Scalpel Scans for Filesystem Intrusion Evidence image

Laravel Scalpel Scans for Filesystem Intrusion Evidence

Read article
Build an AI Chat Agent with Laravel 12, MongoDB Atlas Vector Search, and Voyage AI image

Build an AI Chat Agent with Laravel 12, MongoDB Atlas Vector Search, and Voyage AI

Read article
Claude Opus 4.6 adds adaptive thinking, 128K output, compaction API, and more image

Claude Opus 4.6 adds adaptive thinking, 128K output, compaction API, and more

Read article
No Compromises logo

No Compromises

Joel and Aaron, the two seasoned devs from the No Compromises podcast, are now available to hire for your Laravel project. ⬧ Flat rate of $9500/mo. ⬧ No lengthy sales process. ⬧ No contracts. ⬧ 100% money back guarantee.

No Compromises
PhpStorm logo

PhpStorm

The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

PhpStorm
Pushsilver logo

Pushsilver

Pushsilver is simple invoicing for freelancers and small studios — send polished invoices, automate reminders, and get paid on time without the bloat.

Pushsilver
Acquaint Softtech logo

Acquaint Softtech

Acquaint Softtech offers AI-ready Laravel developers who onboard in 48 hours at $3000/Month with no lengthy sales process and a 100 percent money-back guarantee.

Acquaint Softtech
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift