Search code examples
laravelconfiguration-files

Best place to store app-specific conf files in Laravel


I have some price lists that I can write, for easy maintenance, as arrays and use as a conf file, one per year.

I just wonder what would be the best place, semantically, to store these files :

  • conf/prices/.php
  • storage/app/prices/.php

Thanks for your advices


Solution

  • Configuration files live in the /config directory. In your case, you can create a file at config/prices.php, and access it using the global config helper.

    Given the following prices.php config file:

    <?php
    
    return [
        'cat' => 30,
        'dog' => 20,
        'owl' => 10
    ];
    

    You can access the price of a cat using config('prices.cat').