Firstly what’s the use case for this, there was a client project, where they had a huge list of configurations in a JSON file and I had to use them in the code. An ideal solution for this could be storing these settings in the database and query them on demand, but I was not able to persuade them to this option, so here’s my solution to how I did it.
But if you have a lot more logic happening in your service provider you can create a new one just for this purpose.
Now let’s see how to edit or write to this file when you need to make new changes to the config.
But you can customize this for your own need, let’s say you just need to edit one property, you can do this by updating your config like so config(['settings.name' => 'New Value']) and you could json_encode(config('settings')) and save the results to the file system.