PHPackages                             spinzar/laravel-unobserve - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. spinzar/laravel-unobserve

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

spinzar/laravel-unobserve
=========================

Mute and unmute Laravel observers at will.

02PHP

Since Apr 22Pushed 4y ago1 watchersCompare

[ Source](https://github.com/spinzar/laravel-unobserve)[ Packagist](https://packagist.org/packages/spinzar/laravel-unobserve)[ RSS](/packages/spinzar-laravel-unobserve/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Unobserve
=========

[](#unobserve)

 [![Lint and Test Status](https://github.com/spinzar/laravel-unobserve/actions/workflows/lint-and-test.yml/badge.svg)](https://github.com/spinzar/laravel-unobserve/actions/workflows/lint-and-test.yml/badge.svg) [![Quality Score](https://camo.githubusercontent.com/2484b81848d29b40cbb1d57af56bc1f308116b8021d828bd7fde44ebad7f97e5/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7370696e7a61722f6c61726176656c2d756e6f6273657276652e737667)](https://scrutinizer-ci.com/g/spinzar/laravel-unobserve) [![Coverage](https://camo.githubusercontent.com/7ad75ae0019fbf306429491a778b60d6685736b8a800b378c9d8438cc80a0555/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f7370696e7a61722f6c61726176656c2d756e6f6273657276652e737667)](https://scrutinizer-ci.com/g/spinzar/laravel-unobserve) [![Latest Stable Version](https://camo.githubusercontent.com/f24a0c32319dbf5ee14464ad866d994911cfda28b7587937236ba9325f9d484b/68747470733a2f2f706f7365722e707567782e6f72672f7370696e7a61722f6c61726176656c2d756e6f6273657276652f762f737461626c652e737667)](https://packagist.org/packages/spinzar/laravel-unobserve) [![License](https://camo.githubusercontent.com/4a1d0b8bf7651154c6db8858326b75c18c78a5b89c552574e3ccea1838826dbd/68747470733a2f2f706f7365722e707567782e6f72672f7370696e7a61722f6c61726176656c2d756e6f6273657276652f6c6963656e73652e737667)](https://packagist.org/packages/spinzar/laralel-unobserve)

About Laravel Unobserve
-----------------------

[](#about-laravel-unobserve)

Just for testing with laravel 9.don't use for production.

When testing Laravel applications, we frequently need to "silence" events, so as not to trigger additional side-effects. [Laravel's `Event::fake` method](https://laravel.com/docs/mocking#event-fake) is useful, but muting a specific [model observer](https://laravel.com/docs/eloquent#observers) is still problematic.

Unobserve takes care of that, making it easy to mute and unmute an observer at will.

Requirements and installation
-----------------------------

[](#requirements-and-installation)

Select the appropriate branch for your version of Laravel.

BranchLaravel VersionsPHP Version1.x`^5.8`, `^6.0``^7.2`2.x`^7.0``^7.2.5`3.x`^8.0``^7.3.0`4.x`^8.0``^8.0.0`5.x`^9.0``^8.0.1`Install Unobserve using [Composer](https://getcomposer.org/):

```
composer require monooso/unobserve
```

Usage
-----

[](#usage)

First, add the `CanMute` trait to your observer class.

```
