Laravel provides Laracord with a powerful filesystem abstraction out of the box utilizing Flysystem. This allows you to easily work with files on your system.
Note
For advanced usage, we strongly suggest checking out the official Laravel Filesystem documentation.
Basic file operations can mostly be covered using the File
facade:
<?php
use Illuminate\Support\Facades\File;
File::put('/path/to/file.txt', 'Hello world');
$file = File::get('/path/to/file.txt');
The Storage
facade allows you to interact with your bot's configured storage directly. By default, this is the storage/app
folder inside your bot project.
While in production, the storage
directory will be created alongside the laracord
binary in the current working directory.
<?php
use Illuminate\Support\Facades\Storage;
Storage::put('file.txt', 'Hello world');
$file = Storage::get('file.txt');