way/phpunit-wrappers
way/phpunit-wrappers provides lightweight PHPUnit wrapper utilities for Laravel and PHP projects, helping you write cleaner, more readable tests with less boilerplate. Use it to simplify assertions, test setup, and common testing patterns without changing your existing PHPUnit workflow.
composer require --dev way/phpunit-wrappers. It is a test-only utility, so never put it in require.Should/Assert wrapper plus, depending on version, a trait or global helper functions). Skim src/ so you know exactly which entry point you are using — $this->should(...), $this->assert(...), or the global should()/assert() helpers.TestCase (or a shared test trait) rather than individual tests, so every test in the suite gets the expressive API. In a Laravel app that is tests/TestCase.php; in a plain PHPUnit project it is your abstract base test class.$this->assertSame('Jeffrey', $user->name); write the wrapper equivalent (should($user->name)->equal('Jeffrey') or the assert(...) variant). Do this for one or two assertions, run vendor/bin/phpunit, and confirm the failure messages still point at the right line.tests/TestCase.php (and any abstract unit-test base class). One use statement gives the whole suite the wrapper API, and new tests inherit it automatically.assertSame, assertInstanceOf, assertJsonStructure, mocks, and data-provider plumbing as-is — the wrapper does not replace them.@dataProvider-driven test reads well: should($result)->equal($expected) inside the loop is clearer than a stack of assertSame calls with the same shape.shouldBeActive(), assertHasRole()) in your base class alongside the wrappers. This keeps the readable style consistent while letting you add semantics the package doesn't ship.tests/Feature and tests/Unit alike. It has no service provider or auto-discovery, so nothing to register in config/app.php — it is framework-agnostic and works in any PHPUnit setup.composer.json and treat it as an internal utility you could fork or vendor if it stalls. Do not build critical suite infrastructure on top of it without a copy.expect() API conflicts conceptually and may collide with global helper names. Don't mix Pest expectations with this package's globals in the same project without checking for name clashes.__call wrappers hide type information. IDE autocompletion and Psalm/PHPStan will often see mixed. Add @method docblocks on your base TestCase for the wrapper methods you actually use, or static analysis will complain.assertSame to confirm what is being compared.assertSame / assertTrue explicitly.vendor/.composer require plus the trait import.How can I help you explore Laravel packages today?