Google存储入门

I am having really difficult time trying to connect Google Storage. All I need is to be able to upload PDF file to a bucket that I've created on Google Storage Console. The documentation seems to be all over the place and lacking simple examples of PHP code. So here's what I've done so far:

Installed cloud storage

$ composer require google/cloud-storage

Added billing as per Google's requirement. Enabled Cloud Storage API. Created project and added a bucket.

Attempted to use the following example:

require '../vendor/autoload.php';

define("PROJECT_ID", "my-project");
define("BUCKET_NAME", "my-bucket");
$client = new Google_Client();
$client->setApplicationName("API_Cloud_Storage");
$client->useApplicationDefaultCredentials();

$client->setScopes(["https://www.googleapis.com/auth/cloud-platform"]);

$service = new Google_Service_Storage($client);

$request = $service->buckets->listBuckets(PROJECT_ID);

foreach ($request["items"] as $bucket)
    printf("%s
", $bucket->getName());

Keep on getting error on

Fatal error: Uncaught Error: Class 'Google_Client' not found in /home/domain/public_html/test.php:11 ...

I know the vendor/autoload.php file is loading because I have no issues with AWS in a different script. I didn't even pass the first line. What am I missing?

You have the documentation page for Cloud Storage Client Libraries with a PHP sample and detailed instructions. There's also a link to the GitHub repo for that quickstart, in addition to the one shared by ceejayoz in the comments.