Skip to content

Instantly share code, notes, and snippets.

@Muetze42
Last active June 11, 2024 16:59
Show Gist options
  • Select an option

  • Save Muetze42/58ac82b4ab19822f93be79717ddd1a9a to your computer and use it in GitHub Desktop.

Select an option

Save Muetze42/58ac82b4ab19822f93be79717ddd1a9a to your computer and use it in GitHub Desktop.
Laravel Events

Laravel 11.10

Auth

\Illuminate\Auth\Access\Events\GateEvaluated::class;
\Illuminate\Auth\Events\Attempting::class;
\Illuminate\Auth\Events\Authenticated::class;
\Illuminate\Auth\Events\CurrentDeviceLogout::class;
\Illuminate\Auth\Events\Failed::class;
\Illuminate\Auth\Events\Lockout::class;
\Illuminate\Auth\Events\Login::class;
\Illuminate\Auth\Events\Logout::class;
\Illuminate\Auth\Events\OtherDeviceLogout::class;
\Illuminate\Auth\Events\PasswordReset::class;
\Illuminate\Auth\Events\PasswordResetLinkSent::class;
\Illuminate\Auth\Events\Registered::class;
\Illuminate\Auth\Events\Validated::class;
\Illuminate\Auth\Events\Verified::class;

Bus

\Illuminate\Bus\Events\BatchDispatched::class;

Cache

\Illuminate\Cache\Events\CacheEvent::class;
\Illuminate\Cache\Events\CacheHit::class;
\Illuminate\Cache\Events\CacheMissed::class;
\Illuminate\Cache\Events\KeyForgotten::class;
\Illuminate\Cache\Events\KeyWritten::class;

Console

\Illuminate\Console\Events\ArtisanStarting::class;
\Illuminate\Console\Events\CommandFinished::class;
\Illuminate\Console\Events\CommandStarting::class;
\Illuminate\Console\Events\ScheduledBackgroundTaskFinished::class;
\Illuminate\Console\Events\ScheduledTaskFailed::class;
\Illuminate\Console\Events\ScheduledTaskFinished::class;
\Illuminate\Console\Events\ScheduledTaskSkipped::class;
\Illuminate\Console\Events\ScheduledTaskStarting::class;

Database

\Illuminate\Database\Events\ConnectionEstablished::class;
\Illuminate\Database\Events\ConnectionEvent::class;
\Illuminate\Database\Events\DatabaseBusy::class;
\Illuminate\Database\Events\DatabaseRefreshed::class;
\Illuminate\Database\Events\MigrationEnded::class;
\Illuminate\Database\Events\MigrationEvent::class;
\Illuminate\Database\Events\MigrationStarted::class;
\Illuminate\Database\Events\MigrationsEnded::class;
\Illuminate\Database\Events\MigrationsEvent::class;
\Illuminate\Database\Events\MigrationsStarted::class;
\Illuminate\Database\Events\ModelPruningFinished::class;
\Illuminate\Database\Events\ModelPruningStarting::class;
\Illuminate\Database\Events\ModelsPruned::class;
\Illuminate\Database\Events\NoPendingMigrations::class;
\Illuminate\Database\Events\QueryExecuted::class;
\Illuminate\Database\Events\SchemaDumped::class;
\Illuminate\Database\Events\SchemaLoaded::class;
\Illuminate\Database\Events\StatementPrepared::class;
\Illuminate\Database\Events\TransactionBeginning::class;
\Illuminate\Database\Events\TransactionCommitted::class;
\Illuminate\Database\Events\TransactionCommitting::class;
\Illuminate\Database\Events\TransactionRolledBack::class;

Foundation

\Illuminate\Foundation\Events\DiagnosingHealth::class;
\Illuminate\Foundation\Events\DiscoverEvents::class;
\Illuminate\Foundation\Events\LocaleUpdated::class;
\Illuminate\Foundation\Events\MaintenanceModeDisabled::class;
\Illuminate\Foundation\Events\MaintenanceModeEnabled::class;
\Illuminate\Foundation\Events\PublishingStubs::class;
\Illuminate\Foundation\Events\VendorTagPublished::class;
\Illuminate\Foundation\Http\Events\RequestHandled::class;

Http

\Illuminate\Http\Client\Events\ConnectionFailed::class;
\Illuminate\Http\Client\Events\RequestSending::class;
\Illuminate\Http\Client\Events\ResponseReceived::class;

Log

\Illuminate\Log\Context\Events\ContextDehydrating::class;
\Illuminate\Log\Context\Events\ContextHydrated::class;
\Illuminate\Log\Events\MessageLogged::class;

Mail

\Illuminate\Mail\Events\MessageSending::class;
\Illuminate\Mail\Events\MessageSent::class;

Notifications

\Illuminate\Notifications\Events\BroadcastNotificationCreated::class;
\Illuminate\Notifications\Events\NotificationFailed::class;
\Illuminate\Notifications\Events\NotificationSending::class;
\Illuminate\Notifications\Events\NotificationSent::class;

Queue

\Illuminate\Queue\Events\JobExceptionOccurred::class;
\Illuminate\Queue\Events\JobFailed::class;
\Illuminate\Queue\Events\JobPopped::class;
\Illuminate\Queue\Events\JobPopping::class;
\Illuminate\Queue\Events\JobProcessed::class;
\Illuminate\Queue\Events\JobProcessing::class;
\Illuminate\Queue\Events\JobQueued::class;
\Illuminate\Queue\Events\JobQueueing::class;
\Illuminate\Queue\Events\JobReleasedAfterException::class;
\Illuminate\Queue\Events\JobRetryRequested::class;
\Illuminate\Queue\Events\JobTimedOut::class;
\Illuminate\Queue\Events\Looping::class;
\Illuminate\Queue\Events\QueueBusy::class;
\Illuminate\Queue\Events\WorkerStopping::class;

Redis

\Illuminate\Redis\Events\CommandExecuted::class;

Routing

\Illuminate\Routing\Events\PreparingResponse::class;
\Illuminate\Routing\Events\ResponsePrepared::class;
\Illuminate\Routing\Events\RouteMatched::class;
\Illuminate\Routing\Events\Routing::class;

Laravel Nova 4.34

\Illuminate\Events\NovaServiceProviderRegistered::class;
\Illuminate\Events\ServingNova::class;
\Illuminate\Events\StartedImpersonating::class;
\Illuminate\Events\StoppedImpersonating::class;
<?php
$files = \File::allFiles(base_path('vendor/laravel/framework/src/Illuminate'));
$files = array_map(
fn (\Symfony\Component\Finder\SplFileInfo $fileInfo) => '\Illuminate\\'.str_replace('.php', '', $fileInfo->getRelativePathname()),
$files
);
$files = array_filter($files, fn ($file) => str_contains($file, '\Events\\') && ! str_contains($file, '\Contracts\\'));
$files = array_filter($files, fn ($file) => ! str_contains($file, '.') && ! str_contains($file, '\Illuminate\Events\\'));
$files = array_filter($files, fn ($file) => class_exists($file));
$contents = '';
$title = '#';
$files = array_map(fn (string $file) => $file.'::class;', $files);
foreach ($files as $file) {
$new = explode('\\', $file)[2];
if ($new != $title) {
$title = $new;
if ($contents) {
$contents .= "```\n\n";
}
$contents .= '## '.$title."\n\n```php\n";
}
$contents .= $file."\n";
}
file_put_contents(base_path('events.md'), $contents.'```');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment