PHP code example of stormkix / laravel-sharded-storage
1. Go to this page and download the library: Download stormkix/laravel-sharded-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/ */
stormkix / laravel-sharded-storage example snippets
use Stormkix\ShardedStorage\Facades\ShardedStorage;
// Upload speichern -> "documents/a3/f9/a3f9....pdf"
$path = ShardedStorage::store($request->file('upload'), 'documents');
// oder per Makro direkt am UploadedFile
$path = $request->file('upload')->storeSharded('documents');
// andere Disk
$path = ShardedStorage::disk('s3')->store($file, 'documents');
// eigenen Dateinamen vorgeben (landet trotzdem im passenden Shard)
$path = ShardedStorage::storeAs($file, 'documents', 'rechnung-2026-001.pdf');
// rohen Inhalt speichern, z. B. generierte PDFs
$path = ShardedStorage::put($pdfBinary, 'pdf', 'reports');