Boost your application with
Nabeel Ahmed
Do calculations and and create report
SMTP
Order
Management
System
Order
Management
System
Mails
Notifications
Jobs
<?php
namespace App\Mail;
use Illuminate\Contracts\Queue\ShouldQueue;
class OrderShipped extends Mailable implements ShouldQueue
{
//
}
// Send
Mail::to($user)->send(new OrderShipped($order));
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
class InvoicePaid extends Notification implements ShouldQueue
{
use Queueable;
// ...
}
// Send
$user->notify(new InvoicePaid($invoice));
A beautiful dashboard and code-driven configuration for your Laravel powered Redis queues. Horizon allows you to easily monitor key metrics of your queue system such as job throughput, runtime, and job failures.
/**
* Register the Horizon gate.
*
* This gate determines who can access Horizon in non-local environments.
*
* @return void
*/
protected function gate()
{
Gate::define('viewHorizon', function ($user) {
return in_array($user->email, [
'taylor@laravel.com',
]);
});
}
/**
* Register the Horizon gate.
*
* This gate determines who can access Horizon in non-local environments.
*
* @return void
*/
protected function gate()
{
Gate::define('viewHorizon', function ($user) {
return $user->hasRoleWithPermission('viewHorizon');
});
}
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->command('horizon:snapshot')->everyFiveMinutes();
}
Dashboard which provides information on your job and queue wait times and throughput.
class HorizonServiceProvider extends HorizonApplicationServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
parent::boot();
// Horizon::routeSmsNotificationsTo('15556667777');
Horizon::routeMailNotificationsTo(config('app.admin_email'));
// Horizon::routeSlackNotificationsTo('slack-webhook-url', '#channel');
}
Ge notified when any of your queues has a long wait time.
Get notified when a queued job fails.
return [
/**
* The channels to which the notification will be sent.
*/
'channels' => ['mail', 'slack'],
'mail' => [
'to' => 'email@example.com',
],
'slack' => [
'webhook_url' => env('FAILED_JOB_SLACK_WEBHOOK_URL'),
],
];
Nabeel Ahmed
Horizon Docs:
https://laravel.com/docs/horizon
Horizon advanced concepts:
https://medium.com/@zechdc/laravel-horizon-number-of-workers-and-job-execution-order-21b9dbec72d7
Demo Source Code:
https://github.com/thenabeel/laravelmeetup-18
Spatie Failed Job Monitor Package:
https://github.com/spatie/laravel-failed-job-monitor