Hi All, this is Adi, again with another Laravel blog post. This time, I wanted to share my solution to loading custom settings from a JSON file into Laravel’s config. Firstly, what’s the use case for this? I was working on 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.

Loading the Settings file

First, let’s see how to load this file when the app initializes.

Hi All, this is Adi, again with another Laravel blog post. This time, I wanted to share my solution to loading custom settings from a JSON file into Laravel’s config. Firstly, what’s the use case for this? I was working on 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.
Loading the Settings file
First, let’s see how to load this file when the app initializes. […]