A facade Root has not been set

Just wanted to document here incase anyone else got stuck like me for the last couple of days.

I was getting this error ‘A facade root has not been set’ when trying to use laravel components in a custom theme (not sage based).

I am new when it comese to laravel so reading the laravel docs to understand the request life cycle helped.

In the function.php file I included this code

function laraval_boot(){
    if (! function_exists('\Roots\bootloader')) {
            __('You need to install Acorn to use this theme.', 'sage'),
                'link_url' => 'https://roots.io/acorn/docs/installation/',
                'link_text' => __('Acorn Docs: Installation', 'sage'),

and of course call our add_action

add_action(‘init’, ‘laraval_boot’);

This did the trick for me. Hopefully this can help someone else out if they get stuck.

1 Like

Thanks for the tip!
If you could format the PHP code using the editor button (with backticks), it would be much more readable.