PHP Classes

File: README.md

Recommend this page to a friend!
  Classes of Chun-Sheng, Li   Hello World HTTP Function   README.md   Download  
File: README.md
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: Hello World HTTP Function
PHP example of Google Cloud function
Author: By
Last change:
Date: 2 days ago
Size: 872 bytes
 

Contents

Class file image Download

helloworld_http

Introduction

This is the example for GCP Cloud function with PHP.

Deployment

  • Clone this repository.
  • Running the `compoer install` command to install required dependencies.
  • Running the following command to deploy this function:
function_name="your function name"
REGION="your GCP region"

gcloud functions deploy ${function_name} \
    --gen2 \
    --runtime=php82 \
    --region="$REGION" \
    --source=. \
    --entry-point=helloHttp \
    --trigger-http \
    --allow-unauthenticated

  • Running the following command to delete the function:
function_name="your function name"
REGION="your GCP region"

gcloud functions delete ${function_name} --region="$REGION"

References

  • https://cloud.google.com/functions/docs/create-deploy-http-php
  • https://cloud.google.com/functions/docs/samples/functions-http-cors