Missing Laravel Config Files? Here's How to Publish Them

January 15th, 2025 • 2 minutes read time

Laravel 11 (and onwards) removes some configuration files by default. If you need to modify them, you'll have to publish them yourself. Here's how.

To publish a specific, individual config file in Laravel, run the config:publish command:

php artisan config:publish auth

In the example above, this publishes the config/auth.php config file.

You can also use config:publish on its own and choose the language file you'd like to publish from the terminal's select box.

> php artisan config:publish

  Which configuration file would you like to publish? ─────────┐
    app                                                     
     auth                                                    
     broadcasting                                            
 └──────────────────────────────────────────────────────────────┘

If you'd like to go ahead and publish all config files in Laravel, you can use the --all flag.

php artisan config:publish --all

This command publishes every available configuration file. Don't worry, though; it won't overwrite any previous configuration files you've already published!

You might wonder how Laravel can access specific config values if they're not published. Here's how it works.

All the config files that Laravel needs to operate are tucked away within the framework core. For example, the auth.php config file exists at vendor/laravel/framework/config/auth.php.

These core config files are used if they don't exist within your project. So, as soon as you publish config/auth.php to your project, that takes over and is used (and, of course, you can then modify it).

We've covered a few ways to publish config files in Laravel! While this adds an extra step, selective publishing means you don't end up with more files in your project than you need.

If you found this article helpful, you'll love our practical screencasts.
Author
Alex Garrett-Smith
Share :

Comments

No comments, yet. Be the first!