PHP code example of runtime / google-cloud

1. Go to this page and download the library: Download runtime/google-cloud library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

runtime / google-cloud example snippets



// index.php
// This file is needed for google cloud

// index.php
use Google\CloudFunctions\CloudEvent;

rint the whole CloudEvent
    $stdout = fopen('php://stdout', 'wb');
    fwrite($stdout, $cloudevent);
};

# Default value
FUNCTION_SOURCE=index.php

gcloud functions deploy helloHttp \
 --runtime php74 \
 --trigger-http \
 --allow-unauthenticated \
 --set-env-vars "FUNCTION_SOURCE=public/index.php,APP_ENV=prod"