RouteServiceProvider
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. |
|
| static protected Closure> | $beforeLoadingRoutes | The callbacks that should be run before the application's routes are loaded. |
Methods
Determine whether this provider should be registered and booted.
Register any application services.
Register a booting callback to be run before the "boot" method is called.
Merge the given configuration with the existing configuration.
Get configuration arrays whose entries should be merged by name.
Replace the given configuration with the existing configuration recursively.
Change the configuration with a callback, again whenever a worker rebuilds its configuration.
Load the given routes file if routes are not already cached.
Register a view file namespace.
Register the given view components with a custom prefix.
Register a translation file namespace.
Register a JSON translation file path.
Register database migration paths.
Setup an after resolving listener, or fire immediately if already resolved.
Register migration paths to be published by the publish command.
Register paths to be published by the publish command.
Ensure the publish array for the service provider is initialized.
Add a publish group / tag to the service provider.
Get the paths to publish.
Get the paths for the provider or group (or both).
Get the paths for the provider and group.
Get the service providers available for publishing.
Get the migration paths available for publishing.
Add a provider to the bootstrap provider configuration file.
Remove a provider from the bootstrap provider file.
Register commands that should run on "optimize".
Register commands that should run on "reload".
Get a short descriptive key for the current service provider.
Replace the bootstrap provider file without exposing partial contents.
Get the default providers for a Hypervel application.
Flush all static state.
Forward a method call to the given object.
Forward a method call to the given object, returning $this if the forwarded call returned itself.
Throw a bad method call exception for the given method.
Bootstrap any application services.
Register the callback that will be used to load the application's routes.
Register the callback that will be used to load the application's cached routes.
Register a callback to run just before a route provider loads its routes.
Set the root controller namespace for the application.
Determine if the application routes are cached.
Load the cached routes for the application.
Load the application routes.
Pass dynamic methods onto the router instance.
Details
in
ServiceProvider at line 84
__construct(Application $app)
Create a new service provider instance.
in
ServiceProvider at line 98
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.
at line 51
void
register()
Register any application services.
in
ServiceProvider at line 113
void
booting(Closure $callback)
Register a booting callback to be run before the "boot" method is called.
in
ServiceProvider at line 121
void
booted(Closure $callback)
Register a booted callback to be run after the "boot" method is called.
in
ServiceProvider at line 129
void
callBootingCallbacks()
Call the registered booting callbacks.
in
ServiceProvider at line 139
void
callBootedCallbacks()
Call the registered booted callbacks.
in
ServiceProvider at line 156
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.
Called later, the merge changes configuration every request in the worker shares.
in
ServiceProvider at line 189
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.
in
ServiceProvider at line 199
protected void
replaceConfigRecursivelyFrom(string $path, string $key)
Replace the given configuration with the existing configuration recursively.
Called later, the change reaches configuration every request in the worker shares.
in
ServiceProvider at line 222
protected void
configureUsing(Closure $callback)
Change the configuration with a callback, again whenever a worker rebuilds its configuration.
Use it for values computed from other configuration. Configuration can depend on the worker environment, so the callback is replayed against the rebuilt configuration rather than its first result kept. Cached configuration already holds the result, so the callback does not run.
Called later, the change reaches configuration every request in the worker shares, and is not replayed.
in
ServiceProvider at line 235
protected void
loadRoutesFrom(string $path)
Load the given routes file if routes are not already cached.
in
ServiceProvider at line 245
protected void
loadViewsFrom(array|string $path, string $namespace)
Register a view file namespace.
in
ServiceProvider at line 263
protected void
loadViewComponentsAs(string $prefix, array $components)
Register the given view components with a custom prefix.
in
ServiceProvider at line 279
protected void
loadTranslationsFrom(string $path, string|null $namespace = null)
Register a translation file namespace.
in
ServiceProvider at line 289
protected void
loadJsonTranslationsFrom(string $path)
Register a JSON translation file path.
in
ServiceProvider at line 299
protected void
loadMigrationsFrom(array|string $paths)
Register database migration paths.
in
ServiceProvider at line 313
protected void
callAfterResolving(string $name, Closure $callback)
Setup an after resolving listener, or fire immediately if already resolved.
in
ServiceProvider at line 325
protected void
publishesMigrations(array $paths, mixed $groups = null)
Register migration paths to be published by the publish command.
in
ServiceProvider at line 342
protected void
publishes(array $paths, mixed $groups = null)
Register paths to be published by the publish command.
in
ServiceProvider at line 356
protected void
ensurePublishArrayInitialized(string $class)
Ensure the publish array for the service provider is initialized.
in
ServiceProvider at line 366
protected void
addPublishGroup(string $group, array $paths)
Add a publish group / tag to the service provider.
in
ServiceProvider at line 381
static array
pathsToPublish(string|null $provider = null, string|null $group = null)
Get the paths to publish.
in
ServiceProvider at line 398
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.
in
ServiceProvider at line 418
static protected array
pathsForProviderAndGroup(string $provider, string $group)
Get the paths for the provider and group.
in
ServiceProvider at line 430
static array
publishableProviders()
Get the service providers available for publishing.
in
ServiceProvider at line 438
static array
publishableMigrationPaths()
Get the migration paths available for publishing.
in
ServiceProvider at line 446
static array
publishableGroups()
Get the groups available for publishing.
in
ServiceProvider at line 454
static bool
addProviderToBootstrapFile(string $provider, string|null $path = null)
Add a provider to the bootstrap provider configuration file.
in
ServiceProvider at line 492
static bool
removeProviderFromBootstrapFile(string|array $providersToRemove, string|null $path = null, bool $strict = false)
Remove a provider from the bootstrap provider file.
in
ServiceProvider at line 534
protected void
optimizes(string|null $optimize = null, string|null $clear = null, string|null $key = null)
Register commands that should run on "optimize".
in
ServiceProvider at line 550
protected void
reloads(string $reload, string|null $key = null)
Register commands that should run on "reload".
in
ServiceProvider at line 560
protected string
getProviderKey(string|null $key = null)
Get a short descriptive key for the current service provider.
in
ServiceProvider at line 582
void
commands(array $commands)
Register the package's custom Artisan commands.
The commands are added to every later console application the worker creates.
in
ServiceProvider at line 599
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().
in
ServiceProvider at line 618
protected void
classMap(array $map)
Register class map overrides.
Applies entries to the Composer autoloader immediately. Rejects loaded targets from a different source; repeating the same override is safe. Must be called during register(), before the target class is autoloaded.
in
ServiceProvider at line 627
static protected void
replaceBootstrapProviderFile(string $path, string $content)
Replace the bootstrap provider file without exposing partial contents.
in
ServiceProvider at line 649
static DefaultProviders
defaultProviders()
Get the default providers for a Hypervel application.
at line 188
static void
flushState()
Flush all static state.
in
ForwardsCalls at line 22
protected mixed
forwardCallTo(mixed $object, string $method, array $parameters)
Forward a method call to the given object.
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.
in
ForwardsCalls at line 66
static protected never
throwBadMethodCallException(string $method)
Throw a bad method call exception for the given method.
at line 73
void
boot()
Bootstrap any application services.
at line 82
protected RouteServiceProvider
routes(Closure $routesCallback)
Register the callback that will be used to load the application's routes.
at line 95
static void
loadRoutesUsing(Closure|null $routesCallback)
Register the callback that will be used to load the application's routes.
The callback persists in a static property for the worker lifetime and runs during route loading at boot.
at line 107
static void
loadCachedRoutesUsing(Closure|null $routesCallback)
Register the callback that will be used to load the application's cached routes.
The callback persists in a static property for the worker lifetime and runs during route loading at boot when route cache exists.
at line 125
static void
beforeLoadingRoutes(Closure $callback)
Register a callback to run just before a route provider loads its routes.
The routing provider registered by withRouting() boots after every other provider, so the callback's routes see the patterns those providers register and match before the application's later routes in the same domain scope, though an application route with the same method, domain and URI replaces them. Cached routes already contain them, so the callback does not run.
The callback persists in a static property for the worker lifetime and runs during route loading at boot.
at line 134
protected void
setRootControllerNamespace()
Set the root controller namespace for the application.
at line 144
protected bool
routesAreCached()
Determine if the application routes are cached.
at line 152
protected void
loadCachedRoutes()
Load the cached routes for the application.
at line 168
protected void
loadRoutes()
Load the application routes.
at line 198
mixed
__call(string $method, array $parameters)
Pass dynamic methods onto the router instance.