If you've spent any time developing with Laravel, you likely know how nice the built-in dump and dd functions are.

They're so nice that when you're developing PHP sites outside Laravel you quickly miss the Laravel environment.

Thankfully, you can easily add these helper functions to any PHP project that uses Composer by adding one package to your dependencies — symfony/var-dumper.

This requires using Composer to manage dependencies for your project.

Run the following command in your project's root directory, or wherever your composer.json is located.

bash

composer require symfony/var-dumper

Then you just need to make sure you require Composer's autoload in your wp-config.php — assuming you're using standard WordPress. If you're using another PHP framework, you'll need to require the autoload in your project's starting point.

wp-config.php

require_once __DIR__ . '/vendor/autoload.php';
/* That's all, stop editing! Happy publishing. */

Now you can dump wherever you want!