use Illuminate\Filesystem\Filesystem; $file = new Filesystem; $file->put('path/to/file.txt', 'Hello, World!');
use Illuminate\Filesystem\Filesystem; $data = ['key' => 'value']; $file = new Filesystem; $file->put('path/to/file.json', json_encode($data));This will create a new file (if it doesn't already exist) at the given path with the content '{"key":"value"}'. This method is provided by the Laravel's Illuminate/Filesystem library.