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
Safely Seed Your Vue Components with Blade Double-encoding image

Safely Seed Your Vue Components with Blade Double-encoding

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
A New String Helper, Assert Enums in AssertableJson, and more in Laravel 11.20 image

A New String Helper, Assert Enums in AssertableJson, and more in Laravel 11.20

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

Laravel.io Podcast – #10 Double Colon Pitchforks

Read article
Access Request Data Fluently in Laravel 11.34 image

Access Request Data Fluently in Laravel 11.34

Read article

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

Let your users buy domains without leaving your app

If your Laravel app gives users a site, a storefront, or a workspace, they’ll eventually want their own domain. The name.com API lets them search, register, and connect one without leaving your product. It’s a clean REST API, so Laravel’s HTTP client is all you need.

Let your users buy domains without leaving your app

PhpStorm

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

PhpStorm

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing

Shift

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

Shift

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum