In my previous post on https://dev.to/nasrulhazim/load-dynamically-livewire-components-from-different-namespace-574j, I've hit an issue which causing my boot time to load the Laravel application is very slow. On my machine, it run about 500-800ms, but for my team, sometimes they hit around 5-6 minutes to load for just a page.

So the journey begin to find out what's the issue, why it's taking so long to boot up. At first, I'm looking at my route files, which I have a lot of route files been loaded dynamically like the following: collect(glob(base_path('/routes/web/*.php'))) ->each(function ($path) { require $path; }); Enter fullscreen mode

You can imagined how many files under app/ directory need to be load on initial load.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners