PHPackages                             gpanos/laravel-observe-attribute - 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. [Database &amp; ORM](/categories/database)
4. /
5. gpanos/laravel-observe-attribute

ActiveLibrary[Database &amp; ORM](/categories/database)

gpanos/laravel-observe-attribute
================================

Register model observers using php 8 attributes

1.0.0(4y ago)155MITPHPPHP ^8.0

Since Aug 24Pushed 4y ago2 watchersCompare

[ Source](https://github.com/gpanos/laravel-observe-attribute)[ Packagist](https://packagist.org/packages/gpanos/laravel-observe-attribute)[ Docs](https://github.com/gpanos/laravel-observe-attribute)[ RSS](/packages/gpanos-laravel-observe-attribute/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (6)Versions (2)Used By (0)

PHP 8 attribute to register Laravel model observers.
====================================================

[](#php-8-attribute-to-register-laravel-model-observers)

[![tests](https://github.com/gpanos/laravel-observe-attribute/actions/workflows/tests.yml/badge.svg)](https://github.com/gpanos/laravel-observe-attribute/actions/workflows/tests.yml)[![code style](https://github.com/gpanos/laravel-observe-attribute/actions/workflows/code-style.yml/badge.svg)](https://github.com/gpanos/laravel-observe-attribute/actions/workflows/code-style.yml)

Instead of defining [observers](https://laravel.com/docs/8.x/eloquent#observers) inside service providers this package offers an alternative way to register model observers for your Laravel applications.

Inspired by [spatie/laravel-route-attributes](https://github.com/spatie/laravel-route-attributes)

Installation
------------

[](#installation)

```
composer require gpanos/laravel-observe-attribute
```

Usage
-----

[](#usage)

To register an observer add the `Observe` attribute to your model and pass it your observer class.

```
