SlideShare a Scribd company logo
@dragonmantank
Using PHP
Functions!
(not those functions, Google Cloud
Functions)
PRESENTED BY:
Chris Tankersley
Senior PHP Developer Advocate
@dragonmantank
@dragonmantank
What are Serverless Functions?
@dragonmantank
What are is Serverless
Functions?
@dragonmantank Traditional PHP Application
Web Server
@dragonmantank Traditional PHP Application
Web Server Your PHP Code
@dragonmantank
A Server
Traditional PHP Application
Web Server Your PHP Code
@dragonmantank
A Server
Traditional PHP Application
Web Server Microservice
A Server
Web Server Microservice
A Server
Web Server Microservice
@dragonmantank
$$$$$$$$$$
@dragonmantank Serverless
Your PHP Code
@dragonmantank Serverless
The Cloud
Your PHP Code
@dragonmantank Serverless
Your PHP Code
@dragonmantank Serverless
Your PHP Code
Your PHP Code
Your PHP Code
Your PHP Code
Your PHP Code
Your PHP Code
Your PHP Code
@dragonmantank
$$$
@dragonmantank
What are Serverless Functions?
@dragonmantank
Function
Dictionary Time
A piece of code that takes
one or more inputs,
processes some logic,
and may or may not
return a value
@dragonmantank
Functions
Example Time
// Top level functions
function add(
int $one, int $two
) {
return $one + $two;
}
// Variable functions
$func = function(
int $one, int $two
) {
return $one + $two;
}
@dragonmantank
Functions
Example Time
// Top level functions
function add(
int $one, int $two
) {
return $one + $two;
}
// Variable functions
$func = function(
int $one, int $two
) {
return $one + $two;
}
@dragonmantank
What are Serverless Functions?
@dragonmantank Serverless
Your PHP Function
Your PHP Function
Your PHP Function
Your PHP Function
Your PHP Function
Your PHP Function
Your PHP Function
@dragonmantank
Google Cloud Functions
Newest kid on the block
@dragonmantank
@dragonmantank
@dragonmantank
@dragonmantank
Create a New Project
$ gcloud projects create php-oxford-9181984
@dragonmantank
Create a New Project
@dragonmantank
@dragonmantank
Create a New Function
@dragonmantank
Configure a New Function
@dragonmantank
Configure a New Function
@dragonmantank
Configure a New Function
@dragonmantank
Function Editor
@dragonmantank
Enable Cloud Build API
@dragonmantank
Edit Function
@dragonmantank
Edit Function
@dragonmantank
Edit Function
@dragonmantank
Deploying Function
@dragonmantank
Accessing the Function
$ gcloud functions describe hello-world
@dragonmantank
Accessing the Function
@dragonmantank
It Works!
@dragonmantank
What Makes This Tick?
@dragonmantank
What makes
up a function?
● index.php
● Entry Method
● composer.json
@dragonmantank
What Makes This Tick?
$ mkdir php-oxford
$ cd php-oxford
$ composer require 
google/cloud-functions-framework
@dragonmantank
index.php
@dragonmantank
index.php
@dragonmantank
Test Locally
$ FUNCTION_TARGET=main 
php -S localhost:8080 
vendor/bin/router.php
@dragonmantank
Test Locally
$ FUNCTION_TARGET=main 
php -S localhost:8080 
vendor/bin/router.php
@dragonmantank
Test Locally
$ FUNCTION_TARGET=main 
php -S localhost:8080 
vendor/bin/router.php
@dragonmantank
Test Locally
$ FUNCTION_TARGET=main 
php -S localhost:8080 
vendor/bin/router.php
@dragonmantank
Check it out
@dragonmantank
Deploying
$ gcloud functions deploy 
local-oxford 
/-entry-point main 
/-runtime=php74 
/-trigger-http 
/-allow-unauthenticated 
/-security-level=secure-always
@dragonmantank
Deploying
$ gcloud functions deploy 
local-oxford 
/-entry-point main 
/-runtime=php74 
/-trigger-http 
/-allow-unauthenticated 
/-security-level=secure-always
@dragonmantank
Deploying
$ gcloud functions deploy 
local-oxford 
/-entry-point main 
/-runtime=php74 
/-trigger-http 
/-allow-unauthenticated 
/-security-level=secure-always
@dragonmantank
Deploying
$ gcloud functions deploy 
local-oxford 
/-entry-point main 
/-runtime=php74 
/-trigger-http 
/-allow-unauthenticated 
/-security-level=secure-always
@dragonmantank
Deploying
$ gcloud functions deploy 
local-oxford 
/-entry-point main 
/-runtime=php74 
/-trigger-http 
/-allow-unauthenticated 
/-security-level=secure-always
@dragonmantank
Deploying
$ gcloud functions deploy 
local-oxford 
/-entry-point main 
/-runtime=php74 
/-trigger-http 
/-allow-unauthenticated 
/-security-level=secure-always
@dragonmantank
Deploying
$ gcloud functions deploy 
local-oxford 
/-entry-point main 
/-runtime=php74 
/-trigger-http 
/-allow-unauthenticated 
/-security-level=secure-always
@dragonmantank
Deploying
$ gcloud functions deploy 
local-oxford 
/-entry-point main 
/-runtime=php74 
/-trigger-http 
/-allow-unauthenticated 
/-security-level=secure-always
@dragonmantank
Check it out
@dragonmantank
Check it out
@dragonmantank
Something a bit more real-world
Demo Time
@dragonmantank
Deploying
$ composer require 
vonage/client 
lcobucci/jwt:^3.4
@dragonmantank
Write an Answer Webhook
@dragonmantank
Write an Answer Webhook
@dragonmantank
Write an Answer Webhook
@dragonmantank
Deploying
@dragonmantank
Deploying
$ vonage app:update 
4ec8b8c1-4ba0-4644-bd8f-173d85ce2b40 
/-voice_answer_url=https://us-central1-php-oxford-9
181984.cloudfunctions.net/oxford-demo
@dragonmantank
Deploying
$ vonage app:update 
4ec8b8c1-4ba0-4644-bd8f-173d85ce2b40 
/-voice_answer_url=https://us-central1-php-oxford-9
181984.cloudfunctions.net/oxford-demo
@dragonmantank
Deploying
$ vonage app:update 
4ec8b8c1-4ba0-4644-bd8f-173d85ce2b40 
/-voice_answer_url=https://us-central1-php-oxford-9
181984.cloudfunctions.net/oxford-demo
@dragonmantank
Deploying
$ vonage app:update 
4ec8b8c1-4ba0-4644-bd8f-173d85ce2b40 
/-voice_answer_url=https://us-central1-php-oxford-9
181984.cloudfunctions.net/oxford-demo
@dragonmantank
Try Calling
UK: (+44) 7520645746
US: (+1) 8003819125
@dragonmantank
Resources
● General Documentation
https://cloud.google.com/appengine/docs/standard/php7/runtime
● Service Information
https://cloud.google.com/functions
72
Chris Tankersley
Senior PHP Developer Advocate
at Vonage
@dragonmantank
chris.tankersley@vonage.com

More Related Content

What's hot (20)

PDF
Matt's PSGI Archive
Dave Cross
 
PDF
Perl in the Internet of Things
Dave Cross
 
PDF
No REST - Architecting Real-time Bulk Async APIs
C4Media
 
PDF
Eugene PHP June 2015 - Let's Talk Laravel
anaxamaxan
 
PDF
Beyond Breakpoints: A Tour of Dynamic Analysis
C4Media
 
PDF
Php Dependency Management with Composer ZendCon 2016
Clark Everetts
 
PDF
Building a desktop app with HTTP::Engine, SQLite and jQuery
Tatsuhiko Miyagawa
 
PPTX
Zend con 2016 bdd with behat for beginners
Adam Englander
 
KEY
Plack at OSCON 2010
Tatsuhiko Miyagawa
 
PDF
2021.laravelconf.tw.slides1
LiviaLiaoFontech
 
KEY
Matt Gauger - Lamp vs. the world - MKE PHP Users Group - December 14, 2010
Matt Gauger
 
PPT
Ratpack - Classy and Compact Groovy Web Apps
James Williams
 
KEY
What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...
Matt Gauger
 
PDF
Serverless in production, an experience report (LNUG)
Yan Cui
 
PDF
Stackato v6
Jonas Brømsø
 
PDF
Getting started with Apache Camel - jDays 2013
Claus Ibsen
 
PDF
Everything-as-code. A polyglot adventure. #DevoxxPL
Mario-Leander Reimer
 
ODP
Integration using Apache Camel and Groovy
Claus Ibsen
 
PDF
Serverless in Production, an experience report (cloudXchange)
Yan Cui
 
ODP
Microservices with apache_camel_barcelona
Claus Ibsen
 
Matt's PSGI Archive
Dave Cross
 
Perl in the Internet of Things
Dave Cross
 
No REST - Architecting Real-time Bulk Async APIs
C4Media
 
Eugene PHP June 2015 - Let's Talk Laravel
anaxamaxan
 
Beyond Breakpoints: A Tour of Dynamic Analysis
C4Media
 
Php Dependency Management with Composer ZendCon 2016
Clark Everetts
 
Building a desktop app with HTTP::Engine, SQLite and jQuery
Tatsuhiko Miyagawa
 
Zend con 2016 bdd with behat for beginners
Adam Englander
 
Plack at OSCON 2010
Tatsuhiko Miyagawa
 
2021.laravelconf.tw.slides1
LiviaLiaoFontech
 
Matt Gauger - Lamp vs. the world - MKE PHP Users Group - December 14, 2010
Matt Gauger
 
Ratpack - Classy and Compact Groovy Web Apps
James Williams
 
What's new and great in Rails 3 - Matt Gauger - Milwaukee Ruby Users Group De...
Matt Gauger
 
Serverless in production, an experience report (LNUG)
Yan Cui
 
Stackato v6
Jonas Brømsø
 
Getting started with Apache Camel - jDays 2013
Claus Ibsen
 
Everything-as-code. A polyglot adventure. #DevoxxPL
Mario-Leander Reimer
 
Integration using Apache Camel and Groovy
Claus Ibsen
 
Serverless in Production, an experience report (cloudXchange)
Yan Cui
 
Microservices with apache_camel_barcelona
Claus Ibsen
 

Similar to Using PHP Functions! (Not those functions, Google Cloud Functions) (20)

PDF
Api Design
sumithra jonnalagadda
 
KEY
Intro To Django
Udi Bauman
 
PPT
Open Source Web Technologies
Aastha Sethi
 
ODP
Web Development in Django
Lakshman Prasad
 
PDF
Madison PHP 2015 - DevOps For Small Teams
Joe Ferguson
 
PDF
ZendCon 2015 - DevOps for Small Teams
Joe Ferguson
 
PDF
What's New In Laravel 5
Darren Craig
 
ZIP
Mojolicious
Marcus Ramberg
 
PPTX
One Click Provisioning With Enterprise Manager 12c
Josh Turner
 
PDF
Kicking off with Zend Expressive and Doctrine ORM (PHPNW2016)
James Titcumb
 
PDF
DevOps For Small Teams
Joe Ferguson
 
PDF
Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)
James Titcumb
 
PDF
What’s new in Google Dart - Seth Ladd
jaxconf
 
PPT
Even Faster Web Sites at jQuery Conference '09
Steve Souders
 
PDF
2018 (codeone) Graal VM and MicroProfile a polyglot microservices solution [d...
César Hernández
 
PDF
WebCamp: Developer Day: DDD in PHP on example of Symfony - Олег Зинченко
GeeksLab Odessa
 
PDF
7 recomendaciones para migrar tus aplicaciones a Jakarta EE utilizando Apache...
César Hernández
 
PDF
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...
Codemotion
 
PDF
Leveraging a distributed architecture to your advantage
Michelangelo van Dam
 
PDF
Unit Testing for Great Justice
Domenic Denicola
 
Intro To Django
Udi Bauman
 
Open Source Web Technologies
Aastha Sethi
 
Web Development in Django
Lakshman Prasad
 
Madison PHP 2015 - DevOps For Small Teams
Joe Ferguson
 
ZendCon 2015 - DevOps for Small Teams
Joe Ferguson
 
What's New In Laravel 5
Darren Craig
 
Mojolicious
Marcus Ramberg
 
One Click Provisioning With Enterprise Manager 12c
Josh Turner
 
Kicking off with Zend Expressive and Doctrine ORM (PHPNW2016)
James Titcumb
 
DevOps For Small Teams
Joe Ferguson
 
Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)
James Titcumb
 
What’s new in Google Dart - Seth Ladd
jaxconf
 
Even Faster Web Sites at jQuery Conference '09
Steve Souders
 
2018 (codeone) Graal VM and MicroProfile a polyglot microservices solution [d...
César Hernández
 
WebCamp: Developer Day: DDD in PHP on example of Symfony - Олег Зинченко
GeeksLab Odessa
 
7 recomendaciones para migrar tus aplicaciones a Jakarta EE utilizando Apache...
César Hernández
 
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...
Codemotion
 
Leveraging a distributed architecture to your advantage
Michelangelo van Dam
 
Unit Testing for Great Justice
Domenic Denicola
 
Ad

More from Chris Tankersley (20)

PDF
8 Rules for Better Applications - PHP Tek 2025
Chris Tankersley
 
PDF
The Art of API Design - PHP Tek 2025, Chris Tankersley
Chris Tankersley
 
PDF
Docker is Dead: Long Live Containers
Chris Tankersley
 
PDF
Bend time to your will with git
Chris Tankersley
 
PDF
Dead Simple APIs with OpenAPI
Chris Tankersley
 
PDF
You Got Async in my PHP!
Chris Tankersley
 
ODP
Docker for Developers
Chris Tankersley
 
ODP
They are Watching You
Chris Tankersley
 
ODP
BASHing at the CLI - Midwest PHP 2018
Chris Tankersley
 
PDF
You Were Lied To About Optimization
Chris Tankersley
 
ODP
Docker for PHP Developers - php[world] 2017
Chris Tankersley
 
ODP
Docker for PHP Developers - Madison PHP 2017
Chris Tankersley
 
ODP
Docker for Developers - php[tek] 2017
Chris Tankersley
 
ODP
Why Docker? Dayton PHP, April 2017
Chris Tankersley
 
PPTX
OOP Is More Then Cars and Dogs - Midwest PHP 2017
Chris Tankersley
 
PPTX
From Docker to Production - SunshinePHP 2017
Chris Tankersley
 
PPTX
Docker for Developers - Sunshine PHP
Chris Tankersley
 
PPTX
Coming to Terms with OOP In Drupal - php[world] 2016
Chris Tankersley
 
PPTX
How We Got Here: A Brief History of Open Source
Chris Tankersley
 
PPTX
Docker for PHP Developers - ZendCon 2016
Chris Tankersley
 
8 Rules for Better Applications - PHP Tek 2025
Chris Tankersley
 
The Art of API Design - PHP Tek 2025, Chris Tankersley
Chris Tankersley
 
Docker is Dead: Long Live Containers
Chris Tankersley
 
Bend time to your will with git
Chris Tankersley
 
Dead Simple APIs with OpenAPI
Chris Tankersley
 
You Got Async in my PHP!
Chris Tankersley
 
Docker for Developers
Chris Tankersley
 
They are Watching You
Chris Tankersley
 
BASHing at the CLI - Midwest PHP 2018
Chris Tankersley
 
You Were Lied To About Optimization
Chris Tankersley
 
Docker for PHP Developers - php[world] 2017
Chris Tankersley
 
Docker for PHP Developers - Madison PHP 2017
Chris Tankersley
 
Docker for Developers - php[tek] 2017
Chris Tankersley
 
Why Docker? Dayton PHP, April 2017
Chris Tankersley
 
OOP Is More Then Cars and Dogs - Midwest PHP 2017
Chris Tankersley
 
From Docker to Production - SunshinePHP 2017
Chris Tankersley
 
Docker for Developers - Sunshine PHP
Chris Tankersley
 
Coming to Terms with OOP In Drupal - php[world] 2016
Chris Tankersley
 
How We Got Here: A Brief History of Open Source
Chris Tankersley
 
Docker for PHP Developers - ZendCon 2016
Chris Tankersley
 
Ad

Recently uploaded (20)

PDF
AI security AI security AI security AI security
elite44
 
PPTX
Softuni - Psychology of entrepreneurship
Kalin Karakehayov
 
PPTX
西班牙巴利阿里群岛大学电子版毕业证{UIBLetterUIB文凭证书}文凭复刻
Taqyea
 
PDF
Empowering Local Language Email with IDN & EAI – Powered by XgenPlus
XgenPlus Technologies
 
PDF
Top 10 Testing Procedures to Ensure Your Magento to Shopify Migration Success...
CartCoders
 
PPTX
美国电子毕业证帕克大学电子版成绩单UMCP学费发票办理学历认证
Taqyea
 
PDF
Boardroom AI: The Next 10 Moves | Cerebraix Talent Tech
ssuser73bdb11
 
PDF
BRKSP-2551 - Introduction to Segment Routing.pdf
fcesargonca
 
PDF
The Internet - By the numbers, presented at npNOG 11
APNIC
 
PDF
FutureCon Seattle 2025 Presentation Slides - You Had One Job
Suzanne Aldrich
 
PDF
Cleaning up your RPKI invalids, presented at PacNOG 35
APNIC
 
PPTX
Metaphysics_Presentation_With_Visuals.pptx
erikjohnsales1
 
PPTX
Meloniusk_Communication_Template_best.pptx
howesix147
 
PDF
google promotion services in Delhi, India
Digital Web Future
 
PPTX
原版一样(LHU毕业证书)英国利物浦希望大学毕业证办理方法
Taqyea
 
PPTX
Networking_Essentials_version_3.0_-_Module_5.pptx
ryan622010
 
PPTX
Academic Debate: Creation vs Evolution.pptx
JOHNPATRICKMARTINEZ5
 
PPTX
PHIPA-Compliant Web Hosting in Toronto: What Healthcare Providers Must Know
steve198109
 
DOCX
Custom vs. Off-the-Shelf Banking Software
KristenCarter35
 
PPTX
04 Output 1 Instruments & Tools (3).pptx
GEDYIONGebre
 
AI security AI security AI security AI security
elite44
 
Softuni - Psychology of entrepreneurship
Kalin Karakehayov
 
西班牙巴利阿里群岛大学电子版毕业证{UIBLetterUIB文凭证书}文凭复刻
Taqyea
 
Empowering Local Language Email with IDN & EAI – Powered by XgenPlus
XgenPlus Technologies
 
Top 10 Testing Procedures to Ensure Your Magento to Shopify Migration Success...
CartCoders
 
美国电子毕业证帕克大学电子版成绩单UMCP学费发票办理学历认证
Taqyea
 
Boardroom AI: The Next 10 Moves | Cerebraix Talent Tech
ssuser73bdb11
 
BRKSP-2551 - Introduction to Segment Routing.pdf
fcesargonca
 
The Internet - By the numbers, presented at npNOG 11
APNIC
 
FutureCon Seattle 2025 Presentation Slides - You Had One Job
Suzanne Aldrich
 
Cleaning up your RPKI invalids, presented at PacNOG 35
APNIC
 
Metaphysics_Presentation_With_Visuals.pptx
erikjohnsales1
 
Meloniusk_Communication_Template_best.pptx
howesix147
 
google promotion services in Delhi, India
Digital Web Future
 
原版一样(LHU毕业证书)英国利物浦希望大学毕业证办理方法
Taqyea
 
Networking_Essentials_version_3.0_-_Module_5.pptx
ryan622010
 
Academic Debate: Creation vs Evolution.pptx
JOHNPATRICKMARTINEZ5
 
PHIPA-Compliant Web Hosting in Toronto: What Healthcare Providers Must Know
steve198109
 
Custom vs. Off-the-Shelf Banking Software
KristenCarter35
 
04 Output 1 Instruments & Tools (3).pptx
GEDYIONGebre
 

Using PHP Functions! (Not those functions, Google Cloud Functions)