PHPackages                             monooso/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. monooso/unobserve

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

monooso/unobserve
=================

Mute and unmute Laravel observers at will.

v6.1.1(8mo ago)83388.8k↑18.9%12[2 PRs](https://github.com/monooso/unobserve/pulls)MITPHPPHP ^8.2CI passing

Since Sep 25Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/monooso/unobserve)[ Packagist](https://packagist.org/packages/monooso/unobserve)[ Docs](https://github.com/monooso/unobserve)[ RSS](/packages/monooso-unobserve/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (21)Used By (0)

Unobserve
=========

[](#unobserve)

 [![Lint and Test Status](https://github.com/monooso/unobserve/actions/workflows/lint-and-test.yml/badge.svg)](https://github.com/monooso/unobserve/actions/workflows/lint-and-test.yml) [![Quality Score](https://camo.githubusercontent.com/304848583a59c8ba9fb65ce27d76e64060e904e36a3ee5def21d78558835d838/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6d6f6e6f6f736f2f756e6f6273657276652e737667)](https://scrutinizer-ci.com/g/monooso/unobserve) [![Coverage](https://camo.githubusercontent.com/882658dc4d09150c96879585bfc21912b096bdf829d11c36fd3875d08786736b/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6d6f6e6f6f736f2f756e6f6273657276652e737667)](https://scrutinizer-ci.com/g/monooso/unobserve) [![Latest Stable Version](https://camo.githubusercontent.com/254b7c744611c468e0fdd5c9ddcd623d3e7ff2b66165374b13e903f33125df72/68747470733a2f2f706f7365722e707567782e6f72672f6d6f6e6f6f736f2f756e6f6273657276652f762f737461626c652e737667)](https://packagist.org/packages/monooso/unobserve) [![License](https://camo.githubusercontent.com/0a9e30062b55276fac076d67823df0df085cbe0816eaf8079fa9905390d4f479/68747470733a2f2f706f7365722e707567782e6f72672f6d6f6e6f6f736f2f756e6f6273657276652f6c6963656e73652e737667)](https://packagist.org/packages/monooso/unobserve)

About Unobserve
---------------

[](#about-unobserve)

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 version of Unobserve from the following table.

UnobserveLaravelPHP1.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`, `^10.0``^8.0.0`6.x`^11.0`, `12.0``^8.2.0`Install Unobserve using [Composer](https://getcomposer.org/):

```
composer require monooso/unobserve
```

Usage
-----

[](#usage)

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

```
