Last Updated: February 25, 2016
·
2.001K
· wajatimur

Laravel Config Package Override in Workbench

This example show how to add config override of any package in others package or workbench. You have to put this code in your register method in you service provider.

// Get config loader
$loader = $this->app['config']->getLoader();

// Get environment name
$env = $this->app['config']->getEnvironment();

// Add package namespace with path set base on your requirement
$loader->addNamespace('basset',__DIR__.'/../config/basset');

// Load package override config file
$configs = $loader->load($env,'config','basset');

// Override value
$this->app['config']->set('basset::config',$configs);

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Did you know?

PHP applications still send a browser full of JavaScript. Hardening the server does not inventory the payment, analytics, and plugin scripts that run after the HTML is delivered.

Security insights from Cside