Using autoload.php

127 views
Skip to first unread message

sampath rathnayake

unread,
Sep 26, 2019, 9:46:13 AM9/26/19
to Google App Engine
Hi All,

I'm new to app engine and trying create a app from a sample code.
Can anyone please tell me what is the use of 

require_once __DIR__ . '/vendor/autoload.php';

Is this set of libraries we need to download? 
I'm developing/test locally and deploying in to gcloud project using 'gcloud app deploy'

I can use 
use google\appengine\api\users\User;

but I cannot use
use google\cloud\storage\StorageClient;

Fatal error: Class 'google\cloud\storage\StorageClient' not found in C:\Users..

Is there a component to install for cloud storage?

Thanks

sampath rathnayake

unread,
Sep 26, 2019, 9:46:13 AM9/26/19
to Google App Engine

George (Cloud Platform Support)

unread,
Sep 26, 2019, 2:27:17 PM9/26/19
to Google App Engine
As PHP scripts run relative to the current path,  not to the path of script itself, you can use __DIR__ to change this behavior, so that include refers to the script's own path, as a result.

StorageClient not found error is likely due to the absence of Cloud Storage Client Libraries, which you'll have to install. 

This discussion group is oriented more towards general opinions, trends, and issues of general nature touching the app engine. For coding in PHP, and program architecture, as well as importing Cloud Storage Client Libraries, you may be better served in dedicated forums such as stackoverflow, where experienced programmers are within reach and ready to help. 
Reply all
Reply to author
Forward
0 new messages