Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jackFlick's avatar

Dynamic Filesystem Driver

I'm using the Google Cloud Is there a way that I can make the driver dynamic. My current option is to create a driver in the filesystem per school for example but the downside is if I have 100 schools I also have 100 driver for each school but if there's a way that I can append the authenticated user's database name to the filesystem config it would only have 1 dynamic driver.

Sample Driver filesystems.php

'SCHOOL1' => [
            'driver' => 'gcs',
            'project_id' => env('GOOGLE_CLOUD_PROJECT_ID', 'my-project-id'),
            'key_file' => env('GOOGLE_CLOUD_KEY_FILE',  ''), // optional: /path/to/service-account.json
            'bucket' => env('GOOGLE_CLOUD_STORAGE_BUCKET', 'SCHOOL01'),
            'path_prefix' => env('GOOGLE_CLOUD_STORAGE_PATH_PREFIX', null), // optional: /default/path/to/apply/in/bucket
            'storage_api_uri' => env('GOOGLE_CLOUD_STORAGE_API_URI', null), // see: Public URLs below
            'visibility' => 'private', // optional: public|private
        ],

'SCHOOL2' => [
            'driver' => 'gcs',
            'project_id' => env('GOOGLE_CLOUD_PROJECT_ID', 'my-project-id'),
            'key_file' => env('GOOGLE_CLOUD_KEY_FILE',  ''), // optional: /path/to/service-account.json
            'bucket' => env('GOOGLE_CLOUD_STORAGE_BUCKET', 'SCHOOL02'),
            'path_prefix' => env('GOOGLE_CLOUD_STORAGE_PATH_PREFIX', null), // optional: /default/path/to/apply/in/bucket
            'storage_api_uri' => env('GOOGLE_CLOUD_STORAGE_API_URI', null), // see: Public URLs below
            'visibility' => 'private', // optional: public|private
        ],

Hope someone can help on this. Thanks in advance

0 likes
0 replies

Please or to participate in this conversation.