You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
current method mergeConfigFrom() overwrites any duplicate keys between vendor and published config with the published config (which is what you want) the problem is when values are arrays, vendor cant (afaik) cleanly add values in the subarrays, this can be useful if any future package update has config keys that are in a subarray but not in the published config file (yes I know about default values if config key is missing) and if you want to update values in any other config file, e.g. add a database connection or auth provider/guard
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
current method
mergeConfigFrom()
overwrites any duplicate keys between vendor and published config with the published config (which is what you want) the problem is when values are arrays, vendor cant (afaik) cleanly add values in the subarrays, this can be useful if any future package update has config keys that are in a subarray but not in the published config file (yes I know about default values if config key is missing) and if you want to update values in any other config file, e.g. add a database connection or auth provider/guardSay I have a vendor/.../apple.php
in published config/apple.php
With
array_merge()
the expected result is missing "subKey2" as "key2" is overwrittenI think it makes sense to have "subKey2" unless it is explicitly removed
'subKey2' => NULL
with
array_replace_recursive()
the expected result iscurrent method: in
Illuminate\Support\ServiceProvider::mergeConfigFrom()
updated:
Maybe this shouldn't be the default case, if so then maybe add another method
recursiveMergeConfigFrom()
Beta Was this translation helpful? Give feedback.
All reactions