<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
klytron / laravel-google-drive-filesystem example snippets
use Illuminate\Support\Facades\Storage;
// Store a file
Storage::disk('google')->put('example.txt', 'Hello, Google Drive!');
// Retrieve a file
$content = Storage::disk('google')->get('example.txt');
// List files in a directory
$files = Storage::disk('google')->files('/');
// Delete a file
Storage::disk('google')->delete('example.txt');
// Check if file exists
if (Storage::disk('google')->exists('example.txt')) {
// File exists
}
// Get file size
$size = Storage::disk('google')->size('example.txt');
// Get last modified time
$modified = Storage::disk('google')->lastModified('example.txt');
// Create a directory (folders are created automatically when uploading files)
Storage::disk('google')->makeDirectory('uploads/images');
// List directories
$directories = Storage::disk('google')->directories('/');
// List all contents (files and folders)
$contents = Storage::disk('google')->allFiles('/');
// Delete a directory and all its contents
Storage::disk('google')->deleteDirectory('uploads/images');