Registering Booting or Booted Callbacks


You want something to happen during the boot process.

You have a service provider you want to perform a specific task right before or right after the application is booted.


Use App::booting() or App::booted()

    // Code to execute right after the app is booted.
    // Code to execute right before the app is booted.


Understand where this happens in the request lifecycle.

  1. First, all the service providers are booted.
  2. Next, any booting() callbacks are called.
  3. Finally, any booted() callbacks are called.

See Understanding the Request Lifecycle.

comments powered by Disqus