src/IMAP/Providers/LaravelServiceProvider.php
private function setVendorConfig(){

        $config_key = 'imap';
        $path = __DIR__.'/../../config/'.$config_key.'.php';

        $vendor_config = require $path;
        $config = $this->app['config']->get($config_key, []);

        $this->app['config']->set($config_key, $this->array_merge_recursive_distinct($vendor_config, $config));

        $config = $this->app['config']->get($config_key);

        if(is_array($config)){
            if(isset($config['default'])){
                if(isset($config['accounts']) && $config['default'] != false){

                    $default_config = $vendor_config['accounts']['default'];
                    if(isset($config['accounts'][$config['default']])){
                        $default_config = array_merge($default_config, $config['accounts'][$config['default']]);
                    }

                    if(is_array($config['accounts'])){
                        foreach($config['accounts'] as $account_key => $account){
                            $config['accounts'][$account_key] = array_merge($default_config, $account);
                        }
                    }
                }
            }
        }

        $this->app['config']->set($config_key, $config);
    }
private function setVendorConfig(){

        $config_key = 'imap';
        $path = __DIR__.'/../../config/'.$config_key.'.php';

        $vendor_config = require $path;
        $config = $this->app['config']->get($config_key, []);

        $this->app['config']->set($config_key, $this->array_merge_recursive_distinct($vendor_config, $config));

        $config = $this->app['config']->get($config_key);

        if(is_array($config)){
            if(isset($config['default'])){
                if(isset($config['accounts']) && $config['default'] != false){

                    $default_config = $vendor_config['accounts']['default'];
                    if(isset($config['accounts'][$config['default']])){
                        $default_config = array_merge($default_config, $config['accounts'][$config['default']]);
                    }

                    if(is_array($config['accounts'])){
                        foreach($config['accounts'] as $account_key => $account){
                            $config['accounts'][$account_key] = array_merge($default_config, $account);
                        }
                    }
                }
            }
        }

        $this->app['config']->set($config_key, $config);
    }
private function setVendorConfig ( ) { $ config_key = 'imap' ; $ path = __DIR__ . '/../../config/' . $ config_key . '.php' ; $ vendor_config = require $ path ; $ config = $ this -> app [ 'config' ] -> get ( $ config_key , [ ] ) ; $ this -> app [ 'config' ] -> set ( $ config_key , $ this -> array_merge_recursive_distinct ( $ vendor_config , $ config ) ) ; $ config = $ this -> app [ 'config' ] -> get ( $ config_key ) ; if ( is_array ( $ config ) ) { if ( isset ( $ config [ 'default' ] ) ) { if ( isset ( $ config [ 'accounts' ] ) && $ config [ 'default' ] != false ) { $ default_config = $ vendor_config [ 'accounts' ] [ 'default' ] ; if ( isset ( $ config [ 'accounts' ] [ $ config [ 'default' ] ] ) ) { $ default_config = array_merge ( $ default_config , $ config [ 'accounts' ] [ $ config [ 'default' ] ] ) ; } if ( is_array ( $ config [ 'accounts' ] ) ) { foreach ( $ config [ 'accounts' ] as $ account_key => $ account ) { $ config [ 'accounts' ] [ $ account_key ] = array_merge ( $ default_config , $ account ) ; } } } } } $ this -> app [ 'config' ] -> set ( $ config_key , $ config ) ; }
Merge the vendor settings with the local config

The default account identifier will be used as default for any missing account parameters.
If however the default account is missing a parameter the package default account parameter will be used.
This can be disabled by setting imap.default in your config file to 'false'
Merge the vendor settings with the local config