Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Google Cloud Supports PHP on Cloud Functions

Google Cloud Supports PHP on Cloud Functions

This item in japanese


Google Cloud recently announced the public preview of PHP on Cloud Functions. The Functions Framework for PHP supports HTTP functions, to respond to HTTP events, and CloudEvent functions to process events sourced from external and internal Google Cloud services like Pub/Sub, Cloud Storage and Firestore.

Cloud Functions is a serverless execution environment for building and connecting cloud services with functions executed in language-specific runtimes, supporting Node.js, Python, Go, Java, .NET, Ruby and now PHP.

The open-source Functions Framework for PHP is available on GitHub. It supports lightweight functions that run in different environments, including a local development machine, Knative-based environments, Cloud Run and Cloud Run on GKE. The PHP 7.4 environment includes the runtime, the operating system, and a library that invokes the function.

Brent Shaffer, developer programs engineer at Google, and Vinod Ramachandran, product manager at Google, explain how to use PHP libraries:

The PHP Functions Framework fits comfortably with popular PHP development processes and tools. Include a composer.json file in your deployment, and those packages will be installed and the autoloader will be registered. Include a php.ini file, and your custom configuration will be loaded and extensions enabled.

Logging is supported using Cloud Logging, with information and error messages supported using Google’s Cloud Client Libraries or standard error stderr. Cloud Functions is not the only service supporting PHP on GCP, with PHP functions supported on Cloud Run.

The addition of a general-purpose scripting language will extend the audience of Cloud Functions: McDougall, technical lead at Squarefoot Capital and founder of the PHP user group for South Wales, tweets:

Super happy to see support for PHP coming to GCP! The lack of support has meant I've avoided cloud functions, now I can finally use it. So many ideas, so many options, so much awesome.

Stephen Musoke Senkomago, eHealth technologist and open source advocate, agrees:

Google finally sees the light and comes into the game with PHP Cloud Functions

On a thread on Reddit, user Arney highlights that Google is the only cloud provider supporting PHP in functions as a service:

That looks pretty cool! I've always wanted to use PHP with AWS Lambda, but so far there is no official / easy support for it, without using Bref for example. I'm sure there will be wrappers for Symfony / Laravel soon. Depending on the load, you might be able to run smaller websites and apps entirely within the free tier.

Azure Functions currently supports C#, JavaScript, F#, Java, PowerShell, Python and TypeScript. AWS Lambda natively supports Java, Go, PowerShell, Node.js, C#, Python, and Ruby code.

Regardless of the programming language used, Google Cloud has a monthly free tier that includes two million invocations on Cloud Functions, 400000 GB-seconds and 200000 GHz-seconds of compute time.

Rate this Article


Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p