Overwrite laravel package config in own package

Viewed 78

I have multiple laravel 8 projects with some common logic. For these logics, I am currently creating a package, so that I can use it in all projects and don't have to make changes multiple times.

In all these projects, I am using spatie/laravel-feed package, which has a config file feed.php to customize the paths/routes. Is there a way to create a centralized config file feed.php inside the package? So the hierarchy of config merging should be:

  1. vendor/spatie/laravel-feed/config/feed.php
  2. vendor/my-package/-my-package/config/feed.php
  3. config/feed.php

Using the following in the my-package ServiceProvider::register method doesn't work:

$this->mergeConfigFrom(
    __DIR__.'/../../config/feed.php', 'feed',
);
0 Answers
Related