PHP code example of ssntpl / cloud-storage

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

    

ssntpl / cloud-storage example snippets


   'disks' => [
      'local' => [
         'driver' => 'local',
         'root' => storage_path('app/private'),
         'write_enabled' => true,
         'write_priority' => 2,
         'read_priority' => 1,
         'retention' => 1,
      ],
      'cloud_disk' => [
         'driver' => 'cloud',
         'disks' => [
            'local', // just write here disk name and other configuration variable can be set on this disk configuration array as mention above.
            [
               'driver' => 'local',
               'root' => storage_path('app/public'),
               'url' => env('APP_URL').'/storage',
               'visibility' => 'public',
               'write_enabled' => true, // false means read only opertions should be done. default is true
               'write_priority' => 1, // 0 means least priority. default is 0
               'read_priority' => 2, // 0 means least priority. default is 0
               'retention' => 0, // in days, 0 means no retention. default is 0. if retention is greater than 0, make sure your queue connection sould not be sync.
            ],
         ],
      ],

      // Define other disks (remote disks used in the cloud disk above)
   ],
   

   Storage::disk('cloud_disk')->put('path/to/file.jpg', $fileContents);
   

   $file = Storage::disk('cloud_disk')->get('path/to/file.jpg');