Support the ongoing development of Laravel.io →
Configuration Packages Architecture

Hi all,

I have a laravel package that requires other packages via composer dependencies (let's say that we have package "A" that requires package "B").

My goal is to change the configuration file contents on "B" package from "A" package's logic. Which is the best way to do this? Store the configuration in the database is not an option.

Thank you in advance.

Last updated 2 years ago.
0

You can use laravel runtime configuration (Config::set) from your package service provider register() function.

Last updated 2 years ago.
0

codextends said:

You can use laravel runtime configuration (Config::set) from your package service provider register() function.

Hi codextends, i've tried, but i need the configuration changes permanently. Package "B" is a complex package that reads configurations from different environments like artisan-cli and web runtime.

My options at this time are: (1) - https://github.com/daftspunk/laravel-config-writer (it's not in packagist but i can publish) (2) - Use simply File::put and rewrite the configuration file (this removes all file style and comments) (3) - Use simply File::put and change content with a simple regex (i don't like this)

I think this is a big feature, since allow package interworking.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

shaggyz shaggyz Joined 22 May 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.