Download the PHP package reedware/laravel-events without Composer

On this page you can find all versions of the php package reedware/laravel-events. 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-events

Laravel Events

Latest Stable Version Laravel Version Build Status

This package allows you to define all of your events in a simple configuration file.

Introduction

Events in Laravel are a fantastic tool to use. However, once you start leaning into events heavily, managing everything through the service provider can be a bit cumbersome. While event discovery exists (since Laravel 5.8), this doesn't always solve the entire problem. This package will allow you to define listeners, subscribers, and observers within a configuration file. Additionally, the implementation allows you to be a bit more lackadaisical with registration, with no performance cost after caching events.

Installation

Composer

First, start by installing this package.

Configuration

Next, you'll need to get your hands on the events.php configuration file. You can either copy it directly, or publish it.

Service Provider

Finally, you'll need to modify your service provider. You can either extend the example provider in the package, or you can utilize the trait.

Extending the Service Provider

Using the Trait instead

If you've overridden the default listens() method, be sure to yield the configured events:

After that, you're good to start configuring your events!

Usage

This package offers four types of event registration:

As you dive in, you'll discover that there's more than one way to register an event binding. This package offers various alternatives so that you can do whatever makes the most since for you and your application.

Event / Listener Mapping

This is the traditional "listens" array that is typically a property within your EventServerProvider. You can list each event, and the listeners that listen to them.

Example:

Explicit Bindings

If your listener doesn't use the traditional handle method, you can call out the method directly like so:

Implicit Bindings

If your alternative method starts with the word handle (e.x. handleRegistration), and accepts the type-hinted event, you don't have do specify the custom method explicitly:

Listener:

Configuration:

Alternative Subscriber Bindings

Since you can utilize a non handle method through implicit or explicit binding, you could technically register your subscribers within the Event / Listener mapping. This can make sense if you want to list your subscribers under each respective event, rather than listing all events that are subscribed to.

Example:

Subscriber / Event Mapping

When working with subscribers, it often makes sense to list the subscribed events together. When listing subscribers in the configuration file, they do not need a subscribe method.

Configuration:

Subscriber:

Remember that implicit bindings requires the method to start with the word handle, even when type-hinted.

Pro-Tip: If you plan to always use implicit bindings for subscribers, consider using Event Discovery!

Explicit Bindings

Similar to the event / listener mapping, you may also use expicit binding:

Observer / Model Mapping

When fully utilized, observers often observe more than one model. Listing the models under the observers make more sense in this case. Here's how you can configure observers:

This package fully supports custom observables, provided that they are registered either as a property or within the construction of the model.

Model / Observer Mapping

You may prefer to instead list out models, and describe the observers beneath them. Both options are provided so that you can do what makes the most sense for you and your application. Here's how listing the model first would work:

Event Caching

This package fully supports Event Caching. In fact, given how observers are registered under the hood, you will likely see a significant performance boost if you're using a lot of observers within your application.

To cache events, run the event:cache artisan command. Should you need to clear the event cache, you can run the event:clear artisan command.

Event Discovery

This package fully supports Event Discovery, and it does not conflict with the configuration file. Both configured events and discovered events are merged in the registration process.

Additionally, any section of the event configuration can be omitted entirely. If you decide to use event discovery for all of your events, and wish to only configure your observers, you can remove the "listen" and "subscribe" arrays without issue.


All versions of laravel-events with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1.3|^8.0
laravel/framework Version ^6.19|^7.0|^8.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 reedware/laravel-events contains the following files

Loading the files please wait ....