PHP code example of glueful / storage-gcs

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

    

glueful / storage-gcs example snippets


'gcs' => [
    'driver' => 'gcs',
    'bucket' => env('GCS_BUCKET'),
    'project_id' => env('GCS_PROJECT_ID'),
    'key_file' => env('GCS_KEY_FILE'), // path to service-account JSON
    'prefix' => env('GCS_PREFIX', ''),
    'signed_ttl' => (int) env('GCS_SIGNED_URL_TTL', 3600),
    'max_signed_ttl' => (int) env('GCS_MAX_SIGNED_URL_TTL', 86400),
],

// config/uploads.php
'native_urls' => [
    'disks' => [
        'gcs' => [
            'enabled' => true,
            'public' => true,
            'private' => false,
            'private_ttl' => 300,
        ],
    ],
    'max_private_ttl' => 900,
],
bash
php glueful storage:test gcs
bash
php glueful storage:test gcs --write