Reputation: 1287
I'm looking for a way to write to laravel 5 configuration files, in a cleaner and easier way then using the good old str_replace
.
There are laravel 4 solutions: How to edit and save custom config files in Laravel? and: https://github.com/daftspunk/laravel-config-writer
But this is not working in laravel 5.
Upvotes: 2
Views: 1770
Reputation: 435
From version 5.1 you are able to do next for changing any config file:
config(['YOUR-CONFIG.YOUR_KEY' => 'NEW_VALUE']);
$text = '<?php return ' . var_export(config('YOUR-CONFIG'), true) . ';';
file_put_contents(config_path('YOUR-CONFIG.php'), $text);
Upvotes: 1