If you want to move files in your system, or to different providers like AWS S3 and Dropbox. By default, Laravel Zero ships with the Filesystem component of Laravel.
Note: By default the root directory is
use Storage; Storage::put("reminders.txt", "Task 1");
use Illuminate\Support\Facades\File; File::put("/path/to/file/reminders.txt", "Task 1");
When using the filesystem be aware that when you build the application with
app:build you create a
.phar file. You can not add, update or delete files inside the
We are currently looking into streamlining the filesystem access. The code below is an example of how you can currently write files from the built application to the current working directory.
If you want to use the
Storage facade you will need to use a config file, similar to how Laravel does it.
- Create a file
- Copy and paste the following contents. This code will replace the default
your-app-name/storage/appfolder with the current working directory.
<?php return [ 'default' => 'local', 'disks' => [ 'local' => [ 'driver' => 'local', 'root' => getcwd(), ], ], ];
- Use the
Storagefacade like you would before.
File facade is just the same as normal
File::put(getcwd() . "/reminders.txt", "Task 1");