How to use google cloud storage as Laravel 5 filesystem?
Asked Answered
P

2

6

I'm developing an application that lets my users upload files, and I've made it works with "local" disk using filesystem feature, but now I want to migrate and use google Google Cloud Storage for it.

It has been a lot difficult to find some useful information. In the docs there is an "example" for work with dropbox, but it's not complete. It doesn't shows how to config drivers and disk, so it isn't clear enough for me.

I would like to know what to do, since I have no idea from now.

I've just used this tutorial http://www.codetutorial.io/laravel-5-file-upload-storage-download/ and it's working for local, so I really need to migrate to google cloud storage, and only that. I'm using openshift and I feel comfortable about it.

Could you please help me to know what should I configure filesystem to be used as I need?

Thank you

Patriciate answered 26/9, 2015 at 22:18 Comment(0)
P
15

I've found a solution.

It seems that Google Cloud Storage uses the same api than Amazon S3, so I could use it as I would use amazon, the same driver.

The only thing I needed to change was when I config disks in laravel, using this code in config/filesystems when adding a disk for google:

'google' => [
    'driver' => 's3',
     'key' => 'xxx',
     'secret' => 'xxx',
     'bucket' => 'qrnotesfiles',
     'base_url'=>'https://storage.googleapis.com'
]
Patriciate answered 28/9, 2015 at 4:17 Comment(5)
Where do I find my key/secret? Can't seem to see it in GCPNeomaneomah
This link says how to create the key/secret cloud.google.com/storage/docs/migrating#keysInca
It seems like Aws\S3\S3Client no longer supports passing base_url? league/flysystem-aws-s3-v3 ^1.0Blank
Does this still work? Getting an error about missing regionOutwardbound
To get "league/flysystem-aws-s3-v3": "^1.0" working specify region and set endpoint instead of base_url.Marion
F
-4

I didn't find solutions\adapters like here

This is what i found but it's for google drive.

Fissure answered 26/9, 2015 at 22:21 Comment(1)
Thank you, but the second link is for google drive, and I need to use Google Cloud StorageTendance

© 2022 - 2024 — McMap. All rights reserved.