GoogleCloudPlatform / appengine-php-sdk

Google App Engine PHP SDK
Apache License 2.0
29 stars 33 forks source link

Support autoloading #22

Closed hdp617 closed 1 year ago

hdp617 commented 4 years ago

In PHP 5.5, users can write code like [0]

// Simple HTTP GET and PUT operators.
$app->get('/memcache/{key}', function ($key) {
    # [START gae_memcache_get]
    $memcache = new Memcache;
    return $memcache->get($key);
    # [END gae_memcache_get]
});

without importing the Memcache class from the SDK.

Can we achieve this in PHP 7.x with autoloading? @bshaffer

cc: @hazemm96

[0] https://github.com/GoogleCloudPlatform/php-docs-samples/blob/eec5f5ca0c7757a9ef7afaeeeaa3c60228393f44/appengine/php55/memcache/app.php#L55

hazemm96 commented 4 years ago

Asked this to mtraver a while ago. We can't and he said we shouldn't attempt to support it. So as mentioned in the doc just asking users to modify their composer.json should be good enough because what's in the composer.json is installed automatically.

On Fri, Oct 9, 2020 at 4:01 PM Huy Pham notifications@github.com wrote:

In PHP 5.5, users can write code like [0]

// Simple HTTP GET and PUT operators. $app->get('/memcache/{key}', function ($key) {

[START gae_memcache_get]

$memcache = new Memcache;
return $memcache->get($key);
# [END gae_memcache_get]

});

without importing the Memcache class from the SDK.

Can we achieve this in PHP 7.x with autoloading? @bshaffer https://github.com/bshaffer

cc: @hazemm96 https://github.com/hazemm96

[0] https://github.com/GoogleCloudPlatform/php-docs-samples/blob/eec5f5ca0c7757a9ef7afaeeeaa3c60228393f44/appengine/php55/memcache/app.php#L55

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GoogleCloudPlatform/appengine-php-sdk/issues/22, or unsubscribe https://github.com/notifications/unsubscribe-auth/APOMUFA3P653POTGXEC2KX3SJ6I3TANCNFSM4SKTXTQA .

hdp617 commented 4 years ago

Are we talking about the same thing. I'm referring to autoloading the classes provided by the SDK; not installing the SDK on behalf of users if it's not in composer.json. cc @mtraver

mtraver commented 4 years ago

Right, those are different things. Autoloading is fine. What I said is that we shouldn't ship the SDK with the runtime like we do for PHP 5.5. Users must include it in composer.json.