I wanted a simple way to debug memory usage in a Laravel or simple PHP project. Something I can just drop into my code without packages, extensions or what not. This little helper does what I need. ## Setup 1. Create a helpers.php (see below) where ever you want. 2. Add the helper file to your composer.json in the autoload/files section. ```json "autoload": { "files": [ "app/Support/helpers.php", ] }, ``` ## Usage Use the function in any PHP file before and after the code you want to debug like so. ```php \printMemory(); // before the script we want to check $someClass = new SomeClass(); \printMemory(); // after we created our objects $someClass = null; unset($someClass); \printMemory(); // after reset ``` The output will be something like this. image