class RouteServiceProvider extends ServiceProvider mixin Router

Traits

Properties

int $priority

The registration priority for this provider.

from  ServiceProvider
protected array $bootingCallbacks

All of the registered booting callbacks.

from  ServiceProvider
protected array $bootedCallbacks

All of the registered booted callbacks.

from  ServiceProvider
static array $publishes

The paths that should be published.

from  ServiceProvider
static array $publishGroups

The paths that should be published by group.

from  ServiceProvider
static protected array $publishableMigrationPaths

The migration paths available for publishing.

from  ServiceProvider
static array<string, string> $optimizeCommands

Commands that should be run during the "optimize" command.

from  ServiceProvider
static array<string, string> $optimizeClearCommands

Commands that should be run during the "optimize:clear" command.

from  ServiceProvider
static array<string, string> $reloadCommands

Commands that should be run during the "reload" command.

from  ServiceProvider
protected string|null $namespace

The controller namespace for the application.

protected Closure|null $loadRoutesUsing

The callback that should be used to load the application's routes.

static protected Closure|null $alwaysLoadRoutesUsing

The global callback that should be used to load the application's routes.

static protected Closure|null $alwaysLoadCachedRoutesUsing

The callback that should be used to load the application's cached routes.

Methods

__construct(Application $app)

No description

bool
isEnabled()

Determine whether this provider should be registered and booted.

void
register()

Register any application services.

void
booting(Closure $callback)

Register a booting callback to be run before the "boot" method is called.

void
booted(Closure $callback)

Register a booted callback to be run after the "boot" method is called.

void
callBootingCallbacks()

Call the registered booting callbacks.

void
callBootedCallbacks()

Call the registered booted callbacks.

void
mergeConfigFrom(string $path, string $key)

Merge the given configuration with the existing configuration.

array
mergeableOptions(string $name)

Get configuration arrays whose entries should be merged by name.

void
replaceConfigRecursivelyFrom(string $path, string $key)

Replace the given configuration with the existing configuration recursively.

void
loadRoutesFrom(string $path)

Load the given routes file if routes are not already cached.

void
loadViewsFrom(array|string $path, string $namespace)

Register a view file namespace.

void
loadViewComponentsAs(string $prefix, array $components)

Register the given view components with a custom prefix.

void
loadTranslationsFrom(string $path, string|null $namespace = null)

Register a translation file namespace.

void
loadJsonTranslationsFrom(string $path)

Register a JSON translation file path.

void
loadMigrationsFrom(array|string $paths)

Register database migration paths.

void
callAfterResolving(string $name, Closure $callback)

Setup an after resolving listener, or fire immediately if already resolved.

void
publishesMigrations(array $paths, mixed $groups = null)

Register migration paths to be published by the publish command.

void
publishes(array $paths, mixed $groups = null)

Register paths to be published by the publish command.

void
ensurePublishArrayInitialized(string $class)

Ensure the publish array for the service provider is initialized.

void
addPublishGroup(string $group, array $paths)

Add a publish group / tag to the service provider.

static array
pathsToPublish(string|null $provider = null, string|null $group = null)

Get the paths to publish.

static array|null
pathsForProviderOrGroup(string|null $provider, string|null $group)

Get the paths for the provider or group (or both).

static array
pathsForProviderAndGroup(string $provider, string $group)

Get the paths for the provider and group.

static array
publishableProviders()

Get the service providers available for publishing.

static array
publishableMigrationPaths()

Get the migration paths available for publishing.

static array
publishableGroups()

Get the groups available for publishing.

static bool
addProviderToBootstrapFile(string $provider, string|null $path = null)

Add a provider to the bootstrap provider configuration file.

static bool
removeProviderFromBootstrapFile(string|array $providersToRemove, string|null $path = null, bool $strict = false)

Remove a provider from the bootstrap provider file.

void
optimizes(string|null $optimize = null, string|null $clear = null, string|null $key = null)

Register commands that should run on "optimize".

void
reloads(string $reload, string|null $key = null)

Register commands that should run on "reload".

string
getProviderKey(string|null $key = null)

Get a short descriptive key for the current service provider.

void
commands(array $commands)

Register the package's custom Artisan commands.

void
aspects(string|array $aspects)

Register AOP aspects.

void
classMap(array $map)

Register class map overrides.

static void
replaceBootstrapProviderFile(string $path, string $content)

Replace the bootstrap provider file without exposing partial contents.

defaultProviders()

Get the default providers for a Hypervel application.

static void
flushState()

Flush all static state.

mixed
forwardCallTo(mixed $object, string $method, array $parameters)

Forward a method call to the given object.

mixed
forwardDecoratedCallTo(mixed $object, string $method, array $parameters)

Forward a method call to the given object, returning $this if the forwarded call returned itself.

static never
throwBadMethodCallException(string $method)

Throw a bad method call exception for the given method.

void
boot()

Bootstrap any application services.

routes(Closure $routesCallback)

Register the callback that will be used to load the application's routes.

static void
loadRoutesUsing(Closure|null $routesCallback)

Register the callback that will be used to load the application's routes.

static void
loadCachedRoutesUsing(Closure|null $routesCallback)

Register the callback that will be used to load the application's cached routes.

void
setRootControllerNamespace()

Set the root controller namespace for the application.

bool
routesAreCached()

Determine if the application routes are cached.

void
loadCachedRoutes()

Load the cached routes for the application.

void
loadRoutes()

Load the application routes.

mixed
__call(string $method, array $parameters)

Pass dynamic methods onto the router instance.

Details

in ServiceProvider at line 83
__construct(Application $app)

No description

Parameters

Application $app

in ServiceProvider at line 97
bool isEnabled()

Determine whether this provider should be registered and booted.

Hypervel-specific extension (not in Laravel). Override on a subclass to gate registration on runtime config / env / feature flags. When this returns false the provider is instantiated but neither register() nor boot() is called, its bindings/singletons properties are not processed, and it is not tracked in the application's provider list.

Return Value

bool

at line 43
void register()

Register any application services.

Return Value

void

in ServiceProvider at line 112
void booting(Closure $callback)

Register a booting callback to be run before the "boot" method is called.

Parameters

Closure $callback

Return Value

void

in ServiceProvider at line 120
void booted(Closure $callback)

Register a booted callback to be run after the "boot" method is called.

Parameters

Closure $callback

Return Value

void

in ServiceProvider at line 128
void callBootingCallbacks()

Call the registered booting callbacks.

Return Value

void

in ServiceProvider at line 138
void callBootedCallbacks()

Call the registered booted callbacks.

Return Value

void

in ServiceProvider at line 153
protected void mergeConfigFrom(string $path, string $key)

Merge the given configuration with the existing configuration.

Top-level keys use shallow merge (app values override package defaults). Keys declared in mergeableOptions() get an additional one-level-deeper merge so the app can add entries to collection arrays (stores, connections, guards, etc.) without losing the package's default entries.

Parameters

string $path
string $key

Return Value

void

in ServiceProvider at line 196
protected array mergeableOptions(string $name)

Get configuration arrays whose entries should be merged by name.

Override this in a package service provider to list nested configuration arrays whose entries are named. Application entries replace package entries with the same name, while package entries not defined by the application remain. Nested arrays not listed here are replaced completely.

Parameters

string $name

Return Value

array

in ServiceProvider at line 204
protected void replaceConfigRecursivelyFrom(string $path, string $key)

Replace the given configuration with the existing configuration recursively.

Parameters

string $path
string $key

Return Value

void

in ServiceProvider at line 229
protected void loadRoutesFrom(string $path)

Load the given routes file if routes are not already cached.

Parameters

string $path

Return Value

void

in ServiceProvider at line 239
protected void loadViewsFrom(array|string $path, string $namespace)

Register a view file namespace.

Parameters

array|string $path
string $namespace

Return Value

void

in ServiceProvider at line 258
protected void loadViewComponentsAs(string $prefix, array $components)

Register the given view components with a custom prefix.

Parameters

string $prefix
array $components

Return Value

void

in ServiceProvider at line 274
protected void loadTranslationsFrom(string $path, string|null $namespace = null)

Register a translation file namespace.

Parameters

string $path
string|null $namespace

Return Value

void

in ServiceProvider at line 284
protected void loadJsonTranslationsFrom(string $path)

Register a JSON translation file path.

Parameters

string $path

Return Value

void

in ServiceProvider at line 294
protected void loadMigrationsFrom(array|string $paths)

Register database migration paths.

Parameters

array|string $paths

Return Value

void

in ServiceProvider at line 308
protected void callAfterResolving(string $name, Closure $callback)

Setup an after resolving listener, or fire immediately if already resolved.

Parameters

string $name
Closure $callback

Return Value

void

in ServiceProvider at line 320
protected void publishesMigrations(array $paths, mixed $groups = null)

Register migration paths to be published by the publish command.

Parameters

array $paths
mixed $groups

Return Value

void

in ServiceProvider at line 337
protected void publishes(array $paths, mixed $groups = null)

Register paths to be published by the publish command.

Parameters

array $paths
mixed $groups

Return Value

void

in ServiceProvider at line 351
protected void ensurePublishArrayInitialized(string $class)

Ensure the publish array for the service provider is initialized.

Parameters

string $class

Return Value

void

in ServiceProvider at line 361
protected void addPublishGroup(string $group, array $paths)

Add a publish group / tag to the service provider.

Parameters

string $group
array $paths

Return Value

void

in ServiceProvider at line 376
static array pathsToPublish(string|null $provider = null, string|null $group = null)

Get the paths to publish.

Parameters

string|null $provider
string|null $group

Return Value

array

in ServiceProvider at line 393
static protected array|null pathsForProviderOrGroup(string|null $provider, string|null $group)

Get the paths for the provider or group (or both).

Returns null when no filter is specified, allowing caller to fall back to all paths. Returns empty array when a filter is specified but not found.

Parameters

string|null $provider
string|null $group

Return Value

array|null

in ServiceProvider at line 413
static protected array pathsForProviderAndGroup(string $provider, string $group)

Get the paths for the provider and group.

Parameters

string $provider
string $group

Return Value

array

in ServiceProvider at line 425
static array publishableProviders()

Get the service providers available for publishing.

Return Value

array

in ServiceProvider at line 433
static array publishableMigrationPaths()

Get the migration paths available for publishing.

Return Value

array

in ServiceProvider at line 441
static array publishableGroups()

Get the groups available for publishing.

Return Value

array

in ServiceProvider at line 449
static bool addProviderToBootstrapFile(string $provider, string|null $path = null)

Add a provider to the bootstrap provider configuration file.

Parameters

string $provider
string|null $path

Return Value

bool

in ServiceProvider at line 487
static bool removeProviderFromBootstrapFile(string|array $providersToRemove, string|null $path = null, bool $strict = false)

Remove a provider from the bootstrap provider file.

Parameters

string|array $providersToRemove
string|null $path
bool $strict

Return Value

bool

in ServiceProvider at line 529
protected void optimizes(string|null $optimize = null, string|null $clear = null, string|null $key = null)

Register commands that should run on "optimize".

Parameters

string|null $optimize
string|null $clear
string|null $key

Return Value

void

in ServiceProvider at line 545
protected void reloads(string $reload, string|null $key = null)

Register commands that should run on "reload".

Parameters

string $reload
string|null $key

Return Value

void

in ServiceProvider at line 555
protected string getProviderKey(string|null $key = null)

Get a short descriptive key for the current service provider.

Parameters

string|null $key

Return Value

string

in ServiceProvider at line 574
void commands(array $commands)

Register the package's custom Artisan commands.

Parameters

array $commands

Return Value

void

in ServiceProvider at line 590
protected void aspects(string|array $aspects)

Register AOP aspects.

Reads $classes and $priority from each aspect class's default property values via reflection (without instantiating the aspect). Must be called during register(), before boot().

Parameters

string|array $aspects

Return Value

void

in ServiceProvider at line 622
protected void classMap(array $map)

Register class map overrides.

Applies entries to the Composer autoloader immediately. Fails hard if any target class is already loaded. Must be called during register(), before the target class is autoloaded.

Parameters

array $map

originalClass => replacementFilePath

Return Value

void

in ServiceProvider at line 630
static protected void replaceBootstrapProviderFile(string $path, string $content)

Replace the bootstrap provider file without exposing partial contents.

Parameters

string $path
string $content

Return Value

void

in ServiceProvider at line 652
static DefaultProviders defaultProviders()

Get the default providers for a Hypervel application.

Return Value

DefaultProviders

at line 105
static void flushState()

Flush all static state.

Return Value

void

in ForwardsCalls at line 22
protected mixed forwardCallTo(mixed $object, string $method, array $parameters)

Forward a method call to the given object.

Parameters

mixed $object
string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

in ForwardsCalls at line 52
protected mixed forwardDecoratedCallTo(mixed $object, string $method, array $parameters)

Forward a method call to the given object, returning $this if the forwarded call returned itself.

Parameters

mixed $object
string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

in ForwardsCalls at line 66
static protected never throwBadMethodCallException(string $method)

Throw a bad method call exception for the given method.

Parameters

string $method

Return Value

never

Exceptions

BadMethodCallException

at line 64
void boot()

Bootstrap any application services.

Return Value

void

at line 73
protected RouteServiceProvider routes(Closure $routesCallback)

Register the callback that will be used to load the application's routes.

Parameters

Closure $routesCallback

Return Value

RouteServiceProvider

at line 86
static void loadRoutesUsing(Closure|null $routesCallback)

Register the callback that will be used to load the application's routes.

Boot-only. The callback persists in a static property for the worker lifetime and runs during route loading at boot.

Parameters

Closure|null $routesCallback

Return Value

void

at line 97
static void loadCachedRoutesUsing(Closure|null $routesCallback)

Register the callback that will be used to load the application's cached routes.

Boot-only. The callback persists in a static property for the worker lifetime and runs during route loading at boot when route cache exists.

Parameters

Closure|null $routesCallback

Return Value

void

at line 114
protected void setRootControllerNamespace()

Set the root controller namespace for the application.

Return Value

void

at line 124
protected bool routesAreCached()

Determine if the application routes are cached.

Return Value

bool

at line 132
protected void loadCachedRoutes()

Load the cached routes for the application.

Return Value

void

at line 148
protected void loadRoutes()

Load the application routes.

Return Value

void

at line 164
mixed __call(string $method, array $parameters)

Pass dynamic methods onto the router instance.

Parameters

string $method
array $parameters

Return Value

mixed