Looking to hire Laravel developers? Try LaraJobs

laravel-observe-attribute maintained by gpanos

Description
Register model observers using php 8 attributes
Last update
2021/08/24 16:41 (dev-master)
License
Downloads
5

Comments
comments powered by Disqus

PHP 8 attribute to register Laravel model observers.

tests code style

Instead of defining observers inside service providers this package offers an alternative way to register model observers for your Laravel applications.

Inspired by spatie/laravel-route-attributes

Installation

composer require gpanos/laravel-observe-attribute

Usage

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

<?php

#[Observe(UserObserver::class)]
class User extends Authenticatable
{
    ...
}