The storage command
storage creates and cleans the project’s runtime directories: storage/,
storage/cache/, storage/logs/. init creates them with the right permissions,
clean empties their contents while keeping the .gitignore.
What storage is and why
storage is the command for managing writable directories.
The problem. The application needs writable directories for caches and logs, and in the repository they have to be present but empty. Creating and cleaning them by hand is drudgery, especially on a new machine.
The solution. storage init creates the directories with mode 0777 and a
.gitignore, and storage clean empties them safely. That is what this page is
about.
Subcommands
| Subcommand | Purpose |
|---|---|
init |
Create the directories (mode 0777) and drop in a .gitignore |
clean |
Delete the contents, except the .gitignore |
Target flags (both subcommands)
| Flag | Directory |
|---|---|
-s |
storage/ |
-c |
storage/cache/ |
-l |
storage/logs/ |
Without flags — all three.
php call storage init # create every directory
php call storage init -s -c # only storage/ and cache/
php call storage clean -c # clean the cache only
php call storage clean -l # clean the logs onlyclean -s spares the subdirectories
clean -s excludes the cache/ and logs/ subdirectories — they survive the clean,
and only stray files at the root of storage/ are removed.
Next
- Project structure — what lives in
storage/ - Installation —
storage initin the startup checklist - Console — overview