hellonico/var-dumper-configurator

Configure Symfony var-dumper when using outside Symfony

0.2.0 2022-07-12 15:32 UTC

This package is auto-updated.

Last update: 2024-04-07 08:56:38 UTC


README

VarDumper component has some nice features when used with the complete Symfony stack. However, those features are lost or tedious to configure application wide when using in standalone mode.

This package aims to provide a simple way to configure these options such as theme and fileLinkFormat which puts links on dumped objects that directly open related file in your favorite IDE.

Usage

Install the package:

composer req hellonico/var-dumper-configurator --dev

The component is automatically configured with environment variables:

If you're using a .env file:

VAR_DUMPER_THEME=light
VAR_DUMPER_IDE=vscode

Or in pure PHP:

$_SERVER['VAR_DUMPER_THEME'] = 'light';
$_SERVER['VAR_DUMPER_IDE'] = 'vscode';
// OR
putenv('VAR_DUMPER_THEME=light');
putenv('VAR_DUMPER_IDE=vscode');

⚠️ Put those lines BEFORE requiring your vendor/autoload.php file.

You can also call the VarDumperConfigurator::configure method yourself.

HelloNico\VarDumperConfigurator\VarDumperConfigurator::configure('vscode', 'light');

⚠️ Don't require --dev if using it that way.

IDE supported

Check the Symfony docs for a full list of supported IDE: https://symfony.com/doc/current/reference/configuration/framework.html#ide