happyr/service-mocking
HappyR Service Mocking is a Laravel testing helper that makes it easy to replace real services with mocks in the container. Swap bindings during functional and integration tests to isolate dependencies and control behavior without manual container wiring or boilerplate.
$this->mock(), $this->instance(), $this->spy(), Http::fake(), Mail::fake(), Queue::fake()). For a Laravel-first estate, the honest framing is "adopt the pattern, not the dependency."$container->set() doesn't reach private/constructor-injected services. That is the package's legitimate home.app()->make(), Container::get()) that can't be refactored this quarter but still needs deterministic tests.require-dev dependency and can be removed without a release. Caveat stated up front: it is a Symfony package, not a Laravel one, and adoption is thin (45 stars, 0 dependents, single maintainer). Frame it as a tactical convenience worth a one-sprint spike, not a platform bet — and only proceed for the parts of the estate that are genuinely Symfony.MockableServices test trait that resolves configured service IDs from app(), rebinds them to Mockery doubles in setUp(), and restores originals via app()->forgetInstance() in tearDown(). Either way, we ship it behind a thin internal wrapper with a pinned version; if the package stalls, we swap the wrapper's implementation in an afternoon.new or a static factory, the mock never injects and the test passes against the real service. Any adoption must include an assertion that the mock was actually used, or we risk eroding trust in the suite.How can I help you explore Laravel packages today?