# Correct way to boot Laravel in v5

**URL:** https://discourse.roots.io/t/correct-way-to-boot-laravel-in-v5/29438
**Category:** acorn
**Created:** 2025-03-11T15:52:57Z
**Posts:** 3

## Post 1 by @JacobBlana — 2025-03-11T15:52:57Z

What is actually the correct way to boot Laravel with new acorn?  
Because in docs it is wrapped in `after_setup_theme` action but in the [sage repository](https://github.com/roots/sage/blob/afbebbe816d5121d76f52c5ce959ae8ab68b4ca7/functions.php#L34) it self it is without it before loading theme files (setup.php, filters.php)

I naturally followed the sage repository, but it has consequences of functions defined in theme files being non-existent for usage in ServiceProviders or any other class referenced in bootloader.

---

## Post 2 by @bedirhan_dincer — 2025-03-11T21:13:17Z

I also wanted to open a post myself about this but since this looks similar I will (for now) not open a new one.

**Problem:**  
I noticed that using `after_setup_theme` to boot up the Acorn application, stuff like `register_activation_hook` etcetera are not working, with the assumption that these are happening earlier than `after_setup_theme` in the cycle of WordPress.

And when I don’t use the `after_setup_theme` , hooks like `register_activation_hook` are working but unfortunately later failures are happening i.e. in _rest-api.php_ in _wordpress/wp-includes_ where for example using `$wp_rewrite->index_permalinks` is null (see related error below):

```
Exception has occured.
Error: Call to a member function using_index_permalinks() on null.
```

What’s is the solution to this, to use `after_theme_setup` but still be able to have these hooks such as `register_activation_hook` available and usable.

---

## Post 3 by @Log1x — 2025-03-11T22:02:44Z

When booting Acorn in a theme’s `functions.php`, you shouldn’t need `after_setup_theme` - but Acorn does expect functions like [get\_stylesheet\_directory](https://developer.wordpress.org/reference/functions/get_stylesheet_directory/) when booting.

> example using `$wp_rewrite->index_permalinks` is null

You might have to try a lower hook priority or experiment around a bit yourself with finding a solution to this.
