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

maryjoytan's avatar

Optimizing Memory Usage in Laravel App with Debugbar Installed

Greetings Laravel Developers,

I'm currently working on a Laravel application that incorporates the Debugbar package for debugging purposes. However, I've noticed that the app's memory usage is averaging between 19-25MB, which I believe might be suboptimal considering the number of models within the application.

I would greatly appreciate any insights, tips, or best practices on how to optimize memory usage specifically in the context of a Laravel application utilizing Debugbar, especially when dealing with a substantial number of models(some of the pages has 200+ models).

Thank you in advance for your expertise and assistance!

0 likes
2 replies
Snapey's avatar

Only load the data you need. Default behavior is select * but its easy to cut this down

Only load the relationships you need

consider loops where you iterate over large datasets

consider the use of pagination

consider the use of caching data sets

consider the memory used by debugbar

Please or to participate in this conversation.