Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

isimmons's avatar

4.3 where to put things that were formerly in start/global.php

I'm moving my version of the Larabook app over to the new 4.3 dev release. So far so good. I've spent a couple of hours figuring things out by reading the errors and making changes. One issue I've run into is not in the Larabook series. I had blade content tags set in start/global.php

Blade::setContentTags('{{{', '}}}');
Blade::setEscapedContentTags('{{', '}}');

Also in BaseController there is no setUpLayout() method on the extended Controller any more so had to move the view shares to the AppServiceProvider to make currentUser and signedIn variables available to the views.

My understanding is that you would use the boot() method of AppServiceProvider but it doesn't seem to be working for setting the content tags though it works for View::share()

public function boot()
{
    Blade::setContentTags('{{', '}}');
    Blade::setEscapedContentTags('{{{', '}}}');
    View::share('currentUser', Auth::user());
    View::share('signedIn', Auth::user());
}

So I'm wondering where is the correct place to put things that I used to put at the top of global.php since it doesn't exist any more.

0 likes
2 replies
isimmons's avatar

Wow, I noticed my mistake while reading over the posted question. I had mixed up the content tags while switching from

Blade::setContentTags('{{', '}}', true);
Blade::setContentTags('{{{', '}}}', false);

to

Blade::setContentTags('{{', '}}');
Blade::setEscapedContentTags('{{{', '}}}');

But I guess the question still stands. I can extract these out to specific methods like

public function boot()
{
    $this->setContentTags();
    $this->setViewShares();
    //other boot stuff ...
}

So I guess this is the best place to put things now?

unitedworx's avatar
Level 8

I think yes, a BladeConfigServiceProvider.php should be I nice place to put these. Either in the boot method or splitting them further if you have a lot off stuff in there.

4.3 is gonna get us to use service providers a lot more which makes a lot of sence. Feels much more organised this way!

1 like

Please or to participate in this conversation.