class Horizon

Constants

protected CSP_NONCE_CONTEXT_KEY

The context key for Horizon's CSP nonce attribute.

Properties

static Closure|null $authUsing

The callback that should be used to authenticate Horizon users.

static string|null $slackWebhookUrl

The Slack notifications webhook URL.

static string|null $slackChannel

The Slack notifications channel.

static string|null $smsNumber

The SMS notifications phone number.

static string|null $email

The email address for notifications.

static array $databases

The database configuration methods.

Methods

static bool
check(Request|null $request)

Determine if the given request can access the Horizon dashboard.

static Horizon
auth(Closure $callback)

Set the callback that should be used to authenticate Horizon users.

static void
use(string $connection)

Configure the Redis databases that will store Horizon data.

static HtmlString
css()

Get the CSS for the Horizon dashboard.

static HtmlString
js()

Get the JS for the Horizon dashboard.

static array
scriptVariables()

Get the default JavaScript variables for Horizon.

static Horizon
routeMailNotificationsTo(string $email)

Specify the email address to which email notifications should be routed.

static Horizon
routeSlackNotificationsTo(string $url, string|null $channel = null)

Specify the webhook URL and channel to which Slack notifications should be routed.

static Horizon
routeSmsNotificationsTo(string $number)

Specify the phone number to which SMS notifications should be routed.

static Horizon
cspNonce(string $nonce)

Set the CSP nonce to use for style and script tags.

static void
registerDevCommands()

Register the Horizon development commands.

static void
flushState()

Flush all static state.

Details

at line 60
static bool check(Request|null $request)

Determine if the given request can access the Horizon dashboard.

Parameters

Request|null $request

Return Value

bool

at line 74
static Horizon auth(Closure $callback)

Set the callback that should be used to authenticate Horizon users.

Boot-only. The callback persists in a static property for the worker lifetime and runs on every Horizon dashboard request across all coroutines.

Parameters

Closure $callback

Return Value

Horizon

at line 89
static void use(string $connection)

Configure the Redis databases that will store Horizon data.

Boot-only. Mutates process-global config (database.redis.horizon); per-request use races across coroutines.

Parameters

string $connection

Return Value

void

Exceptions

Exception

at line 117
static HtmlString css()

Get the CSS for the Horizon dashboard.

Return Value

HtmlString

at line 143
static HtmlString js()

Get the JS for the Horizon dashboard.

Return Value

HtmlString

at line 166
static array scriptVariables()

Get the default JavaScript variables for Horizon.

Return Value

array

at line 180
static Horizon routeMailNotificationsTo(string $email)

Specify the email address to which email notifications should be routed.

Boot-only. The address persists in a static property for the worker lifetime and is used by every Horizon notification dispatch.

Parameters

string $email

Return Value

Horizon

at line 193
static Horizon routeSlackNotificationsTo(string $url, string|null $channel = null)

Specify the webhook URL and channel to which Slack notifications should be routed.

Boot-only. The URL and channel persist in static properties for the worker lifetime and are used by every Horizon notification dispatch.

Parameters

string $url
string|null $channel

Return Value

Horizon

at line 207
static Horizon routeSmsNotificationsTo(string $number)

Specify the phone number to which SMS notifications should be routed.

Boot-only. The number persists in a static property for the worker lifetime and is used by every Horizon notification dispatch.

Parameters

string $number

Return Value

Horizon

at line 220
static Horizon cspNonce(string $nonce)

Set the CSP nonce to use for style and script tags.

Call this from request middleware so the nonce is isolated to the current request coroutine.

Parameters

string $nonce

Return Value

Horizon

at line 236
static void registerDevCommands()

Register the Horizon development commands.

Boot-only. The registrations persist for the worker lifetime and affect every subsequent development command invocation.

Return Value

void

at line 245
static void flushState()

Flush all static state.

Return Value

void