PHPackages                             score-labs/laravel-event-fake - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. score-labs/laravel-event-fake

ActiveLibrary[Testing &amp; Quality](/categories/testing)

score-labs/laravel-event-fake
=============================

An enhanced event fake for Laravel event testing

2.0(7y ago)5249[1 issues](https://github.com/ScoreLabs/laravel-event-fake/issues)MITPHPPHP &gt;=7.1.3

Since Mar 28Pushed 7y ago1 watchersCompare

[ Source](https://github.com/ScoreLabs/laravel-event-fake)[ Packagist](https://packagist.org/packages/score-labs/laravel-event-fake)[ RSS](/packages/score-labs-laravel-event-fake/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)Dependencies (5)Versions (4)Used By (0)

Laravel Event Fake
==================

[](#laravel-event-fake)

Enhanced Laravel Event Fake for testing

Have you ever wanted more versatility when you're testing your Laravel events? If you're like me, you're uncomfortable with the idea of just testing the listeners in isolation, but leaving all of the events unfaked makes your tests a mess. Well fret no further kindred spirit! **Score Labs' Laravel Event Fake is here!**

So how's it work?
-----------------

[](#so-hows-it-work)

Score Labs' Laravel Event Fake adds two new methods to the already great `Event` facade.

### Installation

[](#installation)

```
composer require --dev score-labs/laravel-event-fake

```

In your test classes, just import the new Event facade

```
use ScoreLabs\Event; // full namespace
use Event; // overwritten alias via laravel auto-discovery
```

Methods
-------

[](#methods)

### Fake Except

[](#fake-except)

There are two ways to call `Event::fakeExcept`:

```
Event::fakeExcept(EventThatIWantToFire::class);
```

Will fake every event *except* for `EventThatIWantToFire`. That event and all of its listeners will fire normally.

```
Event::fakeExcept(EventThatIWantToFire::class, TheOnlyListenerIWantToFire::class);
```

Will fake every event *except* for `EventThatIWantToFire` **and** will spy every listener *except* for `TheOnlyListenerIWantToFire. This usage is great for when you want to isolate a single listener, but you still want to test that the event setup is working as expected.

Once you've passed listeners to spy, you can still assert that they were fired without their code running by using

```
Event::assertHandled(AnotherListener::class);
// or
Event::assertHandled(AnotherListener::class, function ($event) {
    return $event instanceof EventIWantToFire;
});
```

☝️ You can also pass arrays of class names for either argument to allow through multiple events/listeners at once!

### Fake Except Models

[](#fake-except-models)

If you want to fake all events, but you still want events that you manually added in your models `boot` method to fire, just use

```
Event::fakeExceptModels();
```

This way you can fake all events as usual, but still let your models get any necessary information they may need during a creating or saving event.

But what about all of the great existing features of Event::fake?
-----------------------------------------------------------------

[](#but-what-about-all-of-the-great-existing-features-of-eventfake)

They are all still there! This is just a drop in enhancement and will be compatible with all usages of Event::fake in Laravel 5.5+

---

This code is MIT Licensed and open to all contributors. For pull requests, please try to mimic the existing code style.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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

Total

3

Last Release

2816d ago

Major Versions

v1.0 → 2.02018-08-26

PHP version history (2 changes)v1.0PHP &gt;=7.0.0

2.0PHP &gt;=7.1.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/34863929d4af0abbfb1aaeff071a6548385c3bcd92b940fbcc5897a4c4b15114?d=identicon)[BrandonShar](/maintainers/BrandonShar)

---

Top Contributors

[![BrandonShar](https://avatars.githubusercontent.com/u/6599653?v=4)](https://github.com/BrandonShar "BrandonShar (8 commits)")

---

Tags

laravellaravel-eventslaravel-testinglaravel-testingLaravel event

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/score-labs-laravel-event-fake/health.svg)

```
[![Health](https://phpackages.com/badges/score-labs-laravel-event-fake/health.svg)](https://phpackages.com/packages/score-labs-laravel-event-fake)
```

###  Alternatives

[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.4k43.5M5.2k](/packages/larastan-larastan)[imanghafoori/laravel-microscope

Automatically test your laravel application

1.5k613.7k2](/packages/imanghafoori-laravel-microscope)[timacdonald/log-fake

A drop in fake logger for testing with the Laravel framework.

4235.9M56](/packages/timacdonald-log-fake)[illuminate/testing

The Illuminate Testing package.

3315.6M113](/packages/illuminate-testing)[christophrumpel/missing-livewire-assertions

This package adds missing livewire test assertions.

149336.0k9](/packages/christophrumpel-missing-livewire-assertions)[calebdw/larastan-livewire

A Larastan / PHPStan extension for Livewire.

43482.4k3](/packages/calebdw-larastan-livewire)

PHPackages © 2026

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