You are viewing documentation for an outdated version. It is no longer supported!

Events

The Event Dispatcheropen in new window that comes with this package, offers you an application-wide observer pattern implementation. Please read Laravel's documentationopen in new window, to gain some basic understanding of it's capabilities.

Register Event Listeners

By default, when you need to register event listenersopen in new window or subscribersopen in new window, you need to state them within your /configs/events.php configuration file. See the Athenaeum Package for details and examples.

Via Service Provider

If the default approach does not work for you, then you can always create a custom Service Provider that registers your desired listeners.

<?php

namespace Acme\Console\Providers;

use Acme\Users\Events\UserHasRegistered;
use Acme\Users\Listeners\SendWelcomeMessage;
use Aedart\Support\Helpers\Events\DispatcherTrait;
use Illuminate\Support\ServiceProvider;

class MyEventServiceProvider extends ServiceProvider
{
    use DispatcherTrait;

    public function boot()
    {
        $this->getDispatcher()->listen(
            UserHasRegistered::class,
            SendWelcomeMessage::class
        );
    }
}

Limitations

This package does not come with Laravel's Queuesopen in new window. As a consequence of this, queued event listenersopen in new window are not available by default. You could try to include the Queue packageopen in new window by yourself. Read the Service Providers chapter for additional information.