Maximiliano Sosa Maximiliano Sosa - 1 year ago 242
PHP Question

Laravel 5.3 Is safe remove/delete storage folder from Laravel project?

I have a Laravel 5.3 project versioned, and files in this folder are constantly changing.

Is safe to remove from version control system?

If I delete that folder from my working copy, Laravel can keep working?

folder structure

Answer Source

You'll notice in a default Laravel 5.3 install there are 3 folders within storage. It looks like this:

+ storage
    + app
    + framework
    + logs

And each of those subfolders has a .gitignore as well as other folders (also usually with gitignores. Those .gitignore files generally say to ignore all files except for the .gitignore. For example, this is the .gitignore inside storage/logs:


That means that you can keep this in version control, but any file written to that folder (except for the .gitignore file itself) will NOT be in your git repository.

Also, it might help to know that these folders have a specific purpose:

app: Designed to be used as storage for files outside of your root public folder

framework: By defaut, this is where Laravel writes a lot of its files for cache and views

logs: Where the error logs are written

If you delete the root storage folder or these subfolders, the framework will have trouble finding these files and you'll get errors.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download