PHP code example of tetranyble / storage

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

    

tetranyble / storage example snippets


'models' => [
    'workspace' => App\Models\Workspace::class,
    'user' => App\Models\User::class,
],

use Tetranyble\Storage\Concerns\BelongsToStorageWorkspace;
use Tetranyble\Storage\Modules\Workspace\Application\Contracts\StorageUser;

class User extends Authenticatable implements StorageUser
{
    use BelongsToStorageWorkspace;
}

use Tetranyble\Storage\Concerns\HasMedia;
use Tetranyble\Storage\Concerns\ManipulatesMedia;

class Project extends Model
{
    use HasMedia;
    use ManipulatesMedia;
}

use Tetranyble\Storage\Http\Adapters\LaravelIncomingFile;
use Tetranyble\Storage\Modules\Media\Application\UploadMedia;

$media = app(UploadMedia::class)->uploadLibraryFiles(
    workspace: $workspace,
    uploadedFiles: [LaravelIncomingFile::fromUploadedFile($request->file('document'))],
    folderId: $folder?->id,
    actor: $user,
)->first();
bash
composer vendor:publish --tag=tetranyble-storage-config
php artisan migrate
text
POST   /storage/uploads
GET    /storage/uploads/{uploadSession}
PUT    /storage/uploads/{uploadSession}/chunks/{chunk}
POST   /storage/uploads/{uploadSession}/finalize
DELETE /storage/uploads/{uploadSession}
bash
php artisan storage:reconcile-usage
php artisan storage:health --json
bash
php artisan storage:process-media --limit=500
php artisan storage:process-media --limit=500 --retry-failed
bash
php artisan storage:cleanup-orphans
php artisan storage:cleanup-orphans --retry-abandoned  # operator-directed retry after max attempts
php artisan storage:cleanup-direct-uploads --limit=500
bash
php artisan storage:retention
php artisan storage:retention --workspace=42
bash
php artisan storage:health
php artisan storage:health --workspace=42
php artisan storage:health --json
php artisan storage:health --strict