PHP code example of rojtjo / laravel-auto-subscriber
1. Go to this page and download the library: Download rojtjo/laravel-auto-subscriber library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rojtjo / laravel-auto-subscriber example snippets
use Rojtjo\LaravelAutoSubscriber\AutoSubscriber;
final class UserNotifier
{
use AutoSubscriber;
public function welcomeUser(UserCreated $event): void
{
// Send welcome notification..
}
}
use Illuminate\Contracts\Events\Dispatcher;
final class UserNotifier
{
public function subscribe(Dispatcher $events)
{
$events->listen(UserCreated::class, [$this, 'welcomeUser']);
}
// ...
}