Gaufrette icon indicating copy to clipboard operation
Gaufrette copied to clipboard

Adds adapter for Google Cloud Client Library

Open PanzerLlama opened this issue 7 years ago • 14 comments

Hi,

Adapter for http://googlecloudplatform.github.io/google-cloud-php/


This change is Reviewable

PanzerLlama avatar Sep 09 '16 12:09 PanzerLlama

Hello @PanzerLlama,

What's the difference with the current GoogleCloudStorage?

akerouanton avatar Mar 14 '17 11:03 akerouanton

Hi @NiR- ,

Google Cloud Client Library is just an alternative to GCS PHP API lib. Quote from the homepage (https://googlecloudplatform.github.io/google-cloud-php/#/):

"What is the relationship between the Google Cloud Client Library and the Google APIs PHP Client?

[...] The Google Cloud Client Library is built specifically for the Google Cloud Platform and is the recommended way to integrate Google Cloud APIs into your PHP applications. If your application requires both Google Cloud Platform and other Google APIs, the 2 libraries may be used by your application."

Personally I found the documentation for GCCL to be clearer and easier to work with, also this lib is actively developed by Google programmers contrary to the GCS which is generated automatically. In a nutshell - Google recommends GCCL if the app is developed in single language (PHP).

More details on the differences can be found here: https://cloud.google.com/storage/docs/json_api/v1/libraries

PanzerLlama avatar Mar 14 '17 12:03 PanzerLlama

@PanzerLlama Could you update the existing adapter rather than creating a new one?

akerouanton avatar Mar 28 '17 21:03 akerouanton

@NiR- - not sure if this works out well since these are 2 different libraries sitting on top of the Google Cloud API so adding support to the existing adapter would generate a lot of extra code in it. Also the constructor of the existing adapter requires \Google_Service_Storage and my adapter uses \Google\Cloud\Storage\StorageClient so looks like merging will create BC break. (?) I think since these are 2 different libraries it feels right to have 2 different adapters.

edit sometime later: ok, the BC break note is not true. I think I don't get the pros of merging these 2 into one adapter but if you think it's vital I will come into line :) (won't be that quick though).

PanzerLlama avatar Mar 30 '17 12:03 PanzerLlama

Hi @PanzerLlama Sorry for not responding for a long time but we currently having a big internal discussion about the future of Gaufrette (see https://github.com/KnpLabs/Gaufrette/issues/466 and https://github.com/KnpLabs/Gaufrette/issues/464). The main idea for now is to split adapters into meta-packages and limit the amount of adapters we have to maintain.

At the moment we already have a GoogleCloudStorage adapter based on https://github.com/google/google-api-php-client and we don't want to maintain two adapters for the same functionality at the end. Moreover we could not simply replace the GoogleCloudStorage adapter by yours because it would bring BC breaks.

By the way, your implementation seems cool and it would be a waste to simply throw it away.

So I see two solutions:

  1. Let this PR pending until the release of Gaufrette v1.0 -> Deprecate the actual GoogleCloudStorage in Gaufrette v0.4 -> Replace it by your adapter in v1.0

  2. Create a separated repo for your adapter (so not maintained by KnpLabs) We would be happy to mention it in the Gaufrette's README.md

AntoineLelaisant avatar Apr 13 '17 09:04 AntoineLelaisant

@PanzerLlama Indeed, seems to be a bad idea to reuse the current Adapter.

@AntoineLelaisant I would go for the first option, but without even waiting the v1.0 release. If we want to deprecate the old adapter in the v0.4 release we need this new adapter to be available.

akerouanton avatar Apr 17 '17 20:04 akerouanton

Hi @AntoineLelaisant - let's do what you think is best. I'll be away now for around a week but will follow the feedback.

PanzerLlama avatar Apr 18 '17 07:04 PanzerLlama

@NiR- Will do the fixes sometime next week. Thanks for the feedback.

PanzerLlama avatar May 23 '17 07:05 PanzerLlama

@PanzerLlama Is it ready to be merged?

akerouanton avatar Jun 13 '17 21:06 akerouanton

@NiR- yes, done all requested changed (may improve docs later but for now I am done)

PanzerLlama avatar Jun 14 '17 08:06 PanzerLlama

Can't wait for this adapter to be merged. 👍

Thanks for the hard work.

bwegrzyn avatar Jun 17 '17 21:06 bwegrzyn

Hi! Any update on this? Would be great if we could get this merged in. :+1:

Matan avatar Sep 27 '17 16:09 Matan

@NiR- I am not sure why this still is labelled "needs rework" - I am happy to do changes but as far as I can see I did the updates that were requested.

PanzerLlama avatar May 07 '18 12:05 PanzerLlama

For anyone who wants to use this adapter (workaround):

  1. copy this file into your adapters directory: https://github.com/PanzerLlama/Gaufrette/blob/master/src/Gaufrette/Adapter/GoogleCloudClientStorage.php

  2. read: https://github.com/PanzerLlama/Gaufrette/blob/master/doc/adapters/google-cloud-client-storage.md

You can also copy the test but its not required. I use this adapter for well over a year w/o issues.

PanzerLlama avatar Jul 06 '18 11:07 PanzerLlama