Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

Signed URL support? #35

Closed
baj84 opened this issue May 14, 2018 · 3 comments
Closed

Signed URL support? #35

baj84 opened this issue May 14, 2018 · 3 comments

Comments

@baj84
Copy link

baj84 commented May 14, 2018

Hi, Is there a way of generating a signed url?

Cheers

@GAM1972
Copy link

GAM1972 commented Jun 15, 2018

The functionality is already there. Superblast loads the google classes and thats all you need. At least, this works if you are on GCE. I haven't tried on anything else.

$storageClient = new StorageClient([
'projectId' => 'yourID',
'keyFilePath' => '../config/keyfile.json', //I put my keyfile in the config folder
]);
$bucket = $storageClient->bucket('yourbucketname');
$object = $bucket->object(YOURFILEINTHEBUCKET);
$url = $object->signedUrl(new \DateTime('tomorrow'));

@JensJI
Copy link

JensJI commented Oct 22, 2018

Can also be written like this:

$url = Storage::getAdapter()
            ->getBucket()
            ->object($filepath)
            ->signedUrl(now()->addMinutes(15));

@fgilio
Copy link

fgilio commented Dec 11, 2018

Thanks @JensJI

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants