How to add custom config file to app/config in Laravel 5?

Stefan Izdrail

Founder & Senior Architect · 2026-06-29

Laravel Company
Title: Adding Custom Config Files to Laravel App/Config Directory Introduction: In Laravel, config files are essential for storing application configuration settings. By default, Laravel provides several configuration options within the app/config directory. However, sometimes you might need to add your own custom configuration options to accommodate specific project requirements. This blog post aims to provide a comprehensive guide on how to create and utilize a custom config file in your Laravel 5 project. Step 1: Define Your Custom Config File To start, open the existing app/config directory and create a new folder named 'custom_config'. Within this newly created folder, create a PHP file called 'custom_config.php'. This will house all of your custom configuration settings. Step 2: Establish the Basic Structure Inside the 'custom_config.php' file, add the following code to set up the basic structure for your custom config file. ```php [ // Add specific configuration options for your custom section here 'key1' => 'value1', 'key2' => 'value2', '...', ] ]; ``` Step 4: Require the Custom Config File Now that you have defined your custom config file, you need to make it available for use in your Laravel application. To do this, open the 'app/config/app.php' and add the following code at the bottom of the file. This will load your custom configuration file when the application starts. ```php