PHP code example of backtory / laravel-backtory-storage

1. Go to this page and download the library: Download backtory/laravel-backtory-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/ */

    

backtory / laravel-backtory-storage example snippets


'providers' => [
    // ...
    Backtory\Storage\Laravel\BacktoryStorageServiceProvider::class,
]

'backtory' => [
    'driver' => 'backtory',
    'X-Backtory-Authentication-Id' => '',
    'X-Backtory-Authentication-Key' => '',
    'X-Backtory-Storage-Id' => '',
    'domain' => '' // [optional]
],

$disk = Storage::disk('backtory');

// create a file
$disk->put('avatars/file.jpg', $fileContents);

// check if a file exists
$exists = $disk->exists('file.jpg');

// get file modification date
$time = $disk->lastModified('file1.jpg');

// copy a file
$disk->copy('old/file1.jpg', 'newLocaltion');

// move a file
$disk->move('old/file1.jpg', 'newLocation');

// get url to file
$url = $disk->url('folder/my_file.txt');

// See https://laravel.com/docs/5.5/filesystem for full list of available functionality