PHP code example of saeedvir / laravel-gist-storage
1. Go to this page and download the library: Download saeedvir/laravel-gist-storage library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Illuminate\Support\Facades\Storage;
// Write a file
Storage::disk('gist')->put('hello.txt', 'Hello from Laravel!');
// Read a file
$content = Storage::disk('gist')->get('hello.txt');
// Check if file exists
if (Storage::disk('gist')->exists('hello.txt')) {
echo 'File exists!';
}
// Get file size
$size = Storage::disk('gist')->size('hello.txt');
// List all files
$files = Storage::disk('gist')->files();
// Delete a file
Storage::disk('gist')->delete('hello.txt');
// Get the auto-created gist ID
$gistId = Storage::disk('gist')->getAdapter()->getGistId();
use Livewire\Component;
use Livewire\WithFileUploads;
class FileUploader extends Component
{
use WithFileUploads;
public $file;
public function save()
{
$this->validate(['file' => '