Skip to content

Configuration

Data Helpers works out of the box with zero configuration, but you can customize its behavior for your specific needs.

Data Helpers automatically registers its service provider in Laravel. No configuration is required.

You can publish the configuration file:

Terminal window
php artisan vendor:publish --tag=data-helpers-config

This creates config/data-helpers.php:

return [
'performance_mode' => env('DATA_HELPERS_PERFORMANCE_MODE', false),
'cache_enabled' => env('DATA_HELPERS_CACHE_ENABLED', true),
];

Data Helpers automatically registers its bundle in Symfony. No configuration is required.

Create config/packages/data_helpers.yaml:

data_helpers:
performance_mode: '%env(bool:DATA_HELPERS_PERFORMANCE_MODE)%'
cache_enabled: '%env(bool:DATA_HELPERS_CACHE_ENABLED)%'

For plain PHP projects, you can configure Data Helpers programmatically:

use Event4u\DataHelpers\DataHelpersConfig;
DataHelpersConfig::setPerformanceMode(true);
DataHelpersConfig::setCacheEnabled(true);

Enable performance mode for production environments:

DataHelpersConfig::setPerformanceMode(true);

This disables debug features and enables optimizations.

Enable or disable caching:

DataHelpersConfig::setCacheEnabled(true);

Caching improves performance for repeated operations.

You can use environment variables to configure Data Helpers:

DATA_HELPERS_PERFORMANCE_MODE=true
DATA_HELPERS_CACHE_ENABLED=true