Download the PHP package alexstewartja/laravel-attribute-observer without Composer

On this page you can find all versions of the php package alexstewartja/laravel-attribute-observer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-attribute-observer

Laravel Attribute Observer

Laravel Attribute Observer - Social Image

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Donate Buy Me A Coffee

Requirements

Installation

You can install the package via composer:

Configuration

Publish the config file (config/attribute-observer.php) with:

This is the default content of the published config file:

Populate the observers array with your desired Model => Attribute Observer mappings.

Usage

Attribute Observers

The make:laravel-attribute-observer Artisan command is the easiest way to create a new attribute observer class:

This command will place the new attribute observer in your App/AttributeObservers directory. If this directory does not exist, Artisan will create it for you. Your freshly generated attribute observer will look like the following:

You may then modify the code to match your business logic, for example:

Attribute Observer methods are always supplied with the model instance, the new attribute value and the previous attribute value, in that order.

Events

You may observe all the typical CRUD events dispatched by Eloquent models during their lifecycles. Supported events are: creating, created, updating, updated, saving, saved, deleting, deleted.

The naming convention to follow when defining attribute observer methods is: on|AttributeName|Event

So, let's say we want to check a user's email against a global spam/vanity mail list each time they attempt to update it, we would implement that logic in an attribute observer method called onEmailUpdating.

Note that the attribute name must be in PascalCase and the event name must be Capitalized.

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

Donations

I maintain this package in my spare time. If it's beneficial to you, consider donating or buying me a coffee to keep it improving.

Donate Buy Me A Coffee


All versions of laravel-attribute-observer with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0
spatie/laravel-package-tools Version ~1.12.1|^1.13.0
illuminate/contracts Version ^7.0|^8.0|^9.0|^10.0|^11.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package alexstewartja/laravel-attribute-observer contains the following files

Loading the files please wait ....