4

I have another system that will drop in a data.json file somewhere onto my Laravel site/folder structure.

I want only Laravel to be able to be able to read the json file (i.e. a user can't see it by typing a url into a browser).

Where should this file go?

I'm currently torn between putting it in application/models folder or application/[new folder]. My webroot is set to the public folder, so you can't access the application folder via a browser.

If it is in there, I'm assuming I will be able to read it within php but not javascript (which is okay).

Lango
  • 2,995
  • 5
  • 26
  • 27

1 Answers1

6

Just create a new folder in the app/ directory. Thats not visible to outsiders. Everything visible is in the public folder, as you said. If you create a new folder you can autoload it by setting up composer.json.

pat
  • 5,757
  • 5
  • 25
  • 30
  • My understanding is that no folders in the app directory is visible to outsiders? – Lango Mar 22 '13 at 06:31
  • The new folder is what I'm thinking as well. I just wanted to make sure Laravel didn't have a recommended area. I haven't seen the composer.json before. I will look into it. Thanks for the heads up :) – Lango Mar 22 '13 at 06:33
  • Just keep it out of /public and you will be fine. – Collin James Mar 22 '13 at 19:35