I have created a Laravel package, uploaded it to packagist and managed to install it using composer require.
I have now hit a problem and I don't know how to fix it and doing a search does not help.
I have a config file which publishes a default config file to the config directory. I have made changes to the published file and now I want my package to use this config file but it's using the config file within the package and not the newly updated published file.This is my service provider within the vendor src folder
namespace Clystnet\Vtiger;use Illuminate\Support\ServiceProvider;class VtigerServiceProvider extends ServiceProvider{ /** * Bootstrap the application services. * * @return void */ public function boot() { $this->publishes([ __DIR__ . '/Config/config.php' => config_path('vtiger.php'), ], 'vtiger'); // use the vendor configuration file as fallback $this->mergeConfigFrom( __DIR__ . '/Config/config.php', 'vtiger' ); } /** * Register the application services. * * @return void */ public function register() { $this->app->bind('clystnet-vtiger', function () { return new Vtiger(); }); config(['config/vtiger.php', ]); }}
This is my main package class
<?php namespace Clystnet\Vtiger;use Storage;use Illuminate\Support\Facades\Config;class Vtiger{ protected $url; protected $username; protected $accesskey; public function __construct() { // set the API url and username $this->url = Config::get('vtiger.url'); $this->username = Config::get('vtiger.username'); $this->accesskey = Config::get('vtiger.accesskey'); } ...
Within my class I'm doing a var_dump($this->url)
and it's not reading the correct config file.
How do I set it to use the right one?
UPDATE
This is my custom config file and the one that the package is reading
return ['url' => 'path/to/vtiger/webservice','username' => '','accesskey' => '',];