Just a quick note, all these years later. I've just tried the above on our servers with PHP 8.3 & Laravel 10 and it works perfectly, the only real difference is I used a Facade and also typed the $view variable passed to the view composer, not that it's used.
<?php
namespace App\Providers;
use Illuminate\Support\Facades;
use Illuminate\Support\ServiceProvider;
use Illuminate\View\View;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
require_once(base_path('../') . '/init.php');
Facades\View::Composer('*', function (View $view) {
\IPS\Session\Front::i();
});
}
}