laravel/framework — pull request #6442 by rikh42 (2014-11-19 11:23:00+00:00)
Title: Config Closures

Recent changes in the way config arrays are merged causes problems for some packages and raises other issues, such as making it impossible to override some package settings (reported here: https://github.com/laravel/framework/issues/6398 & https://github.com/laravel/framework/issues/6088 )

This proposed solution for Laravel 5 does the following...

1. Reverts the default behaviour to be the same as 4.2 for better compatibility with existing code.
2. Adds support for config php files returning **either an array or a closure**. When a closure is returned, it is used to perform the array merge, allowing any arbitrary config merging strategy (such as appending) to be supported if required. The closure is expected to take a single argument (the existing config array) and return a new array containing the merged result.