SlideShare a Scribd company logo
Expressive Microservice
Framework Blastoff
By:
Adam Culp
Twitter: @adamculp
https://joind.in/talk/cd0e6
2
Expressive Microservice Framework Blastoff
●
About me
– OSS Contributor
– PHP Certified
– Zend Certification Advisory Board
– PHP-Fig voting member (IBM i Toolkit)
– Consultant at Zend Technologies
– Organizer SoFloPHP (South Florida)
– Organizer SunshinePHP (Miami)
– Long distance (ultra) runner
– Photography Enthusiast
– Judo Black Belt Instructor
3
Expressive Microservice Framework Blastoff
●
About me
– OSS Contributor
– PHP Certified
– Zend Certification Advisory Board
– PHP-Fig voting member (IBM i Toolkit)
– Consultant at Zend Technologies
– Organizer SoFloPHP (South Florida)
– Organizer SunshinePHP (Miami)
– Long distance (ultra) runner
– Photography Enthusiast
– Judo Black Belt Instructor
I am the
PHP Ninja!!!
4
Expressive Microservice Framework Blastoff
●
I Help Build The Web
5
Expressive Microservice Framework Blastoff
●
Frameworks Suck
– Complicated
●
Routing
●
Databases
●
Connectivity
●
Communication (HTTP, API)
●
Information Container
●
GUI (html, javascript, templates, CSS,)
●
Errors and Exceptions
●
Validation and Cleansing Data
●
State
6
Expressive Microservice Framework Blastoff
●
Frameworks Web Applications Suck
– Complicated
●
Routing
●
Databases
●
Connectivity
●
Communication (HTTP, API)
●
Information Container
●
GUI (html, javascript, templates, CSS,)
●
Errors and Exceptions
●
Validation and Cleansing Data
●
State
7
Expressive Microservice Framework Blastoff
●
Buzzword Bingo
– We will mention many buzzwords, but...
8
Expressive Microservice Framework Blastoff
●
Microservice
– All the buzz is “microservices”.
– ...complex applications are composed of small, independent processes
communicating with each other using language-agnostic APIs. These
services are small building blocks, highly decoupled and focused on doing
a small task, facilitating a modular approach to system-building. –
Wikipedia
9
Expressive Microservice Framework Blastoff
●
But in PHP...
– How to keep microservices light?
– Microservices shouldn’t be heavy
I’m a
Microservice!!!
10
Expressive Microservice Framework Blastoff
●
Full Stack Frameworks Suck
– Heavy, bloated, slow
– “Lock” you in
– “Kitchen Sink”
– “You don’t need everything, but its there...”
11
Expressive Microservice Framework Blastoff
●
Need For Speed
– What does a microservice “need”?
●
HTTP message layer
●
Routing capabilities
●
Dependency injection
– IoC
– Testable
– Swappable pieces
●
Templating
– Optional (APIs may not need it, except documentation)
12
Expressive Microservice Framework Blastoff
●
PHP Ecosystem Facilitators
– Composer
– Components
– Libraries
– Containers
– Microframeworks
– PHP 7
13
Expressive Microservice Framework Blastoff
●
All The Things!!!
– So many tools:
Monolog
Whoops
Flysystem
IBMiToolkit
OAuth2 Server
https://github.com/ziadoz/awesome-php
Expressive
14
Expressive
Expressive Microservice Framework Blastoff
●
Communication Sucks
– Say what!?!
Monolog
Whoops
Flysystem
IBMiToolkit
OAuth2 Server
15
Expressive Microservice Framework Blastoff
●
PSR-15 (preferred)
– Part of PHP-Fig.org recommendations
– Must implement
●
PsrHttpServerMiddlewareMiddlewareInterface
●
Middleware dispatching systems must implement
– PsrHttpServerMiddlewareDelegateInterface
– PSR-7 Double Pass
●
PsrHttpMessageMessageInterface
– PsrHttpMessageRequestInterface
●
PsrHttpMessageServerRequestInterface
– PsrHttpMessageResponseInterface
●
PsrHttpMessageStreamInterface
● PsrHttpMessageUploadFileInterface
●
PsrHttpMessageUriInterface
16
Expressive Microservice Framework Blastoff
●
Middleware
– ...Middleware makes it easier for software developers to implement
communication and input/output, so they can focus on the specific
purpose of their application. – Wikipedia
– Lighter applications (only what is needed)
– Composed of layers
17
Expressive Microservice Framework Blastoff
●
Zend Expressive
– Microframework built around middleware
– Versions
● Version 1 based on PSR-7
●
Version 2 based on PSR-15
– Very lean runtime
– Use for building:
●
APIs
●
Web applications
● Single page sites
– Choose your own stack
– Great documentation
●
https://zendframework.github.io/zend-expressive/
18
Expressive Microservice Framework Blastoff
●
Zend Expressive
– Not built on Zend Framework, but build by ZF team
●
Zend Framework 3 does include some components now
●
You choose the stack
19
Expressive Microservice Framework Blastoff
●
Composer Install Script
– Done right from the start
All code available at: https://github.com/adamculp/expressive-blastoff
20
Expressive Microservice Framework Blastoff
●
Composer Install Script
21
Expressive Microservice Framework Blastoff
●
Composer Install Script
– Minimal skeleton or full?
●
With or without samples
●
Flat or with modules!
22
Expressive Microservice Framework Blastoff
●
Composer Install Script
– Container options: (container interop)
●
Aura.Di
●
Pimple
●
Zend ServiceManager*
23
Expressive Microservice Framework Blastoff
●
Composer Install Script
– Router options
●
Aura.Router
●
FastRoute*
●
Zend Router
24
Expressive Microservice Framework Blastoff
●
Composer Install Script
– Template engine options:
●
Plates
●
Twig
●
Zend View
●
None*
25
Expressive Microservice Framework Blastoff
●
Composer Install Script
– Error handler options:
●
Whoops*
●
None
26
Expressive Microservice Framework Blastoff
●
Structure
– Folder structure of Zend Expressive Skeleton
27
Expressive Microservice Framework Blastoff
●
Skeleton Application
28
Expressive Microservice Framework Blastoff
●
Not MVC
– Files and structure focused on Actions
29
Expressive Microservice Framework Blastoff
●
The Flow
30
Expressive Microservice Framework Blastoff
●
Initial File
– Front controller (/public/index.php)
31
Expressive Microservice Framework Blastoff
●
Container Creation
– We specified Zend ServiceManager
(/config/container.php)
32
Expressive Microservice Framework Blastoff
●
Load Configs
(/config/config.php)
33
Expressive Microservice Framework Blastoff
●
Load Configs
(/src/App/src/ConfigProvider.php)
34
Expressive Microservice Framework Blastoff
●
Load More Configs
35
Expressive Microservice Framework Blastoff
●
Load Pipelines
– Items to be called as the middleware pipeline.
(/config/pipeline.php)
36
Expressive Microservice Framework Blastoff
●
Load Pipelines
– Items to be called as routed middleware.
(/config/routes.php)
37
Expressive Microservice Framework Blastoff
●
Action Anatomy
– Creates raw JSON response
(/src/App/src/Action/PingAction.php)
38
Expressive Microservice Framework Blastoff
●
JSON Response
– Created by action
39
Expressive Microservice Framework Blastoff
●
Let’s Create a Middleware!!!
40
Expressive Microservice Framework Blastoff
●
Header Middleware
– Create class for new middleware (or include someone else’s)
41
Expressive Microservice Framework Blastoff
●
Header Middleware
– The class to include the very important header
(/src/App/src/Middleware/TheClacksMiddleware.php)
42
Expressive Microservice Framework Blastoff
●
Header Middleware
– Add the middleware to the pipeline
– It will always be included
(/config/pipeline.php)
43
Expressive Microservice Framework Blastoff
●
Header Middleware
– Header for every call now carries our important message
44
Expressive Microservice Framework Blastoff
●
Let’s Create a Database Connected Middleware!!!
●
With Zend Db
45
Expressive Microservice Framework Blastoff
●
Database Connected Example With Zend Db
– First we need a database connection.
●
Will use Zend-Db for this example, but could be anything.
●
Composer to the rescue!
46
Expressive Microservice Framework Blastoff
●
Database Connected Example With Zend Db
– Specify adapter (via Zend/Db/ConfigProvider() in this case)
(/config/config.php)
47
Expressive Microservice Framework Blastoff
●
Database Connected Example With Zend Db
– Provide local/instance configuration
● This would be driver and credentials
● (credentials not needed with sqlite)
(/config/autoload/db.local.php)
48
Expressive Microservice Framework Blastoff
●
Database Connected Example With Zend Db
– Add the new action to dependencies
(/config/autoload/routes.global.php)
49
Expressive Microservice Framework Blastoff
●
Database Connected Example With Zend Db
– Add the new route to dependencies
(/config/routes.php
50
Expressive Microservice Framework Blastoff
●
Database Connected Example With Zend Db
– Create a factory to pass items needed by the action
(/src/App/src/Action/UserListFactory.php)
51
Expressive Microservice Framework Blastoff
●
Database Connected Example With Zend Db
– Create the action (view 1 of 2 - constructor)
(/src/App/src/Action/UserListAction.php)
52
Expressive Microservice Framework Blastoff
●
Database Connected Example With Zend Db
– Create the action (view 2 of 2 - __invoke method)
(/src/App/src/Action/UserListAction.php cont’d)
53
Expressive Microservice Framework Blastoff
●
Database Connected Example With Zend Db
– Create the view template
(/templates/app/user-list.phtml)
54
Expressive Microservice Framework Blastoff
●
Database Connected Example With Zend Db
– Rejoice!
64
Expressive Microservice Framework Blastoff
●
With Zend Expressive:
– Easy to build middleware
– Lightweight, add what is really needed
– Fast – no extra load
– Microservices in PHP are better
65
Expressive Microservice Framework Blastoff
●
Give Zend Expressive a Try...Today!!!
– https://zendframework.github.io/zend-expressive/
●
Thank you!
●
Code at: https://github.com/adamculp/expressive-blastoff
●
Please rate at: https://joind.in/talk/cd0e6
Adam Culp
http://www.rungeekradio.com
http://www.geekyboy.com
Twitter @adamculp
Expressive Microservice Framework Blastoff

More Related Content

What's hot (20)

PDF
Build & deploy PHP application (intro level)
Anton Babenko
 
PDF
Gradle起步走: 以CLI Application為例 @ JCConf 2014
Chen-en Lu
 
PPT
Ratpack - Classy and Compact Groovy Web Apps
James Williams
 
PDF
Gearman work queue in php
Bo-Yi Wu
 
PDF
Ninja Build: Simple Guide for Beginners
Chang W. Doh
 
PDF
"How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie...
Fwdays
 
PDF
Virtual Bolt Workshop, 5 May 2020
Puppet
 
ODP
2017 DevSecCon ZAP Scripting Workshop
Simon Bennetts
 
PDF
cf.Objective() 2017 - Design patterns - Brad Wood
Ortus Solutions, Corp
 
PPTX
They why behind php frameworks
Kirk Madera
 
PPTX
Virtual Bolt Workshop - 6 May
Puppet
 
PPTX
Automation testing with Drupal 8
nagpalprachi
 
PDF
AN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLE
Gavin Pickin
 
PPTX
Manage your Windows Infrastructure with Puppet Bolt - August 26 - 2020
Puppet
 
PDF
Testing with Codeception (Webelement #30)
Adam Štipák
 
PDF
JSDC 2015 - TDD 的開發哲學,以 Node.js 為例
謝 宗穎
 
PDF
3 WAYS TO TEST YOUR COLDFUSION API
Gavin Pickin
 
PPTX
Learning Maven by Example
Hsi-Kai Wang
 
PDF
Bgoug 2019.11 test your pl sql - not your patience
Jacek Gebal
 
PDF
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
Ortus Solutions, Corp
 
Build & deploy PHP application (intro level)
Anton Babenko
 
Gradle起步走: 以CLI Application為例 @ JCConf 2014
Chen-en Lu
 
Ratpack - Classy and Compact Groovy Web Apps
James Williams
 
Gearman work queue in php
Bo-Yi Wu
 
Ninja Build: Simple Guide for Beginners
Chang W. Doh
 
"How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie...
Fwdays
 
Virtual Bolt Workshop, 5 May 2020
Puppet
 
2017 DevSecCon ZAP Scripting Workshop
Simon Bennetts
 
cf.Objective() 2017 - Design patterns - Brad Wood
Ortus Solutions, Corp
 
They why behind php frameworks
Kirk Madera
 
Virtual Bolt Workshop - 6 May
Puppet
 
Automation testing with Drupal 8
nagpalprachi
 
AN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLE
Gavin Pickin
 
Manage your Windows Infrastructure with Puppet Bolt - August 26 - 2020
Puppet
 
Testing with Codeception (Webelement #30)
Adam Štipák
 
JSDC 2015 - TDD 的開發哲學,以 Node.js 為例
謝 宗穎
 
3 WAYS TO TEST YOUR COLDFUSION API
Gavin Pickin
 
Learning Maven by Example
Hsi-Kai Wang
 
Bgoug 2019.11 test your pl sql - not your patience
Jacek Gebal
 
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
Ortus Solutions, Corp
 

Viewers also liked (20)

PDF
Zend expressive workshop
Adam Culp
 
PPTX
How to Make Your Website Not Ugly: 10 Simple UX Tenets for Non-Designers
Hilary Stohs-Krause
 
PDF
Midwest PHP 2017 DevOps For Small team
Joe Ferguson
 
PPTX
OOP Is More Then Cars and Dogs - Midwest PHP 2017
Chris Tankersley
 
PDF
Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)
James Titcumb
 
PPTX
Zend Expressive in 15 Minutes
Chris Tankersley
 
PDF
Microservices pros and cons - houston tech fest
Andrew Siemer
 
PPTX
Standards: Don't pee in the pool
David Yell
 
PDF
Voxxed Days Thesaloniki 2016 - 5 must have patterns for your web-scale micros...
Voxxed Days Thessaloniki
 
PDF
Madison PHP 2015 - DevOps For Small Teams
Joe Ferguson
 
PDF
How to Build Modern Web Applications Using Microservices
DNN
 
PDF
DevOps For Small Teams
Joe Ferguson
 
PDF
Modelling Microservices at Spotify - Petter Mahlen
J On The Beach
 
PDF
One click deployment with Jenkins - PHP Munich
Mayflower GmbH
 
PDF
All the Laravel Things – Up & Running to Making $$
Joe Ferguson
 
PDF
Does Your Code Measure Up?
Adam Culp
 
PDF
Build great products
Adam Culp
 
PDF
Accidental professional
Adam Culp
 
PDF
Managing Quality of Service for Containerized Microservice Applications
Jules Pierre-Louis
 
PDF
DevOps Con 2015: Radical Agility with Autonomous Teams and Microservices in t...
Henning Jacobs
 
Zend expressive workshop
Adam Culp
 
How to Make Your Website Not Ugly: 10 Simple UX Tenets for Non-Designers
Hilary Stohs-Krause
 
Midwest PHP 2017 DevOps For Small team
Joe Ferguson
 
OOP Is More Then Cars and Dogs - Midwest PHP 2017
Chris Tankersley
 
Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)
James Titcumb
 
Zend Expressive in 15 Minutes
Chris Tankersley
 
Microservices pros and cons - houston tech fest
Andrew Siemer
 
Standards: Don't pee in the pool
David Yell
 
Voxxed Days Thesaloniki 2016 - 5 must have patterns for your web-scale micros...
Voxxed Days Thessaloniki
 
Madison PHP 2015 - DevOps For Small Teams
Joe Ferguson
 
How to Build Modern Web Applications Using Microservices
DNN
 
DevOps For Small Teams
Joe Ferguson
 
Modelling Microservices at Spotify - Petter Mahlen
J On The Beach
 
One click deployment with Jenkins - PHP Munich
Mayflower GmbH
 
All the Laravel Things – Up & Running to Making $$
Joe Ferguson
 
Does Your Code Measure Up?
Adam Culp
 
Build great products
Adam Culp
 
Accidental professional
Adam Culp
 
Managing Quality of Service for Containerized Microservice Applications
Jules Pierre-Louis
 
DevOps Con 2015: Radical Agility with Autonomous Teams and Microservices in t...
Henning Jacobs
 
Ad

Similar to Expressive Microservice Framework Blastoff (20)

PDF
DPC2007 Zend Framework (Gaylord Aulke)
dpc
 
PPTX
Zend Products and PHP for IBMi
Shlomo Vanunu
 
PDF
Make your application expressive
Christian Varela
 
PPT
Unit Test for ZF SlideShare Component
Diego Delon
 
PDF
A Tale of Two Toolkits
Zend by Rogue Wave Software
 
PPT
Unit Test for ZF SlideShare Component
Diego Delon
 
PPT
Unit Test for ZF SlideShare Component
Diego Delon
 
PPT
Unit Test for ZF SlideShare Component
Diego Delon
 
PPT
Unit Test for ZF SlideShare Component
Diego Delon
 
PPT
Unit Test for ZF SlideShare Component
Diego Delon
 
PPT
Unit Test for ZF SlideShare Component
Diego Delon
 
PPT
Demo
bkslide
 
PPT
Unit Test for ZF SlideShare Component
Kaiuwe
 
PPT
Unit Test for ZF SlideShare Component
Kaiuwe
 
PPT
Zend
marcosTedsys
 
PPT
green
alind tiwari
 
PPT
Greenathan
alind tiwari
 
PPT
Greenathan
alind tiwari
 
PPT
latest slide
alind tiwari
 
PPT
latest slide
alind tiwari
 
DPC2007 Zend Framework (Gaylord Aulke)
dpc
 
Zend Products and PHP for IBMi
Shlomo Vanunu
 
Make your application expressive
Christian Varela
 
Unit Test for ZF SlideShare Component
Diego Delon
 
A Tale of Two Toolkits
Zend by Rogue Wave Software
 
Unit Test for ZF SlideShare Component
Diego Delon
 
Unit Test for ZF SlideShare Component
Diego Delon
 
Unit Test for ZF SlideShare Component
Diego Delon
 
Unit Test for ZF SlideShare Component
Diego Delon
 
Unit Test for ZF SlideShare Component
Diego Delon
 
Unit Test for ZF SlideShare Component
Diego Delon
 
Demo
bkslide
 
Unit Test for ZF SlideShare Component
Kaiuwe
 
Unit Test for ZF SlideShare Component
Kaiuwe
 
Greenathan
alind tiwari
 
Greenathan
alind tiwari
 
latest slide
alind tiwari
 
latest slide
alind tiwari
 
Ad

More from Adam Culp (20)

PDF
Hypermedia
Adam Culp
 
PDF
Putting legacy to REST with middleware
Adam Culp
 
PDF
php-1701-a
Adam Culp
 
PDF
Release your refactoring superpower
Adam Culp
 
PDF
Managing Technical Debt
Adam Culp
 
PDF
Developing PHP Applications Faster
Adam Culp
 
PDF
Containing Quality
Adam Culp
 
PDF
Debugging elephpants
Adam Culp
 
PDF
Refactoring Legacy Code
Adam Culp
 
PDF
Deprecated: Foundations of Zend Framework 2
Adam Culp
 
PDF
Clean application development tutorial
Adam Culp
 
PDF
Refactoring 101
Adam Culp
 
PDF
Essential git for developers
Adam Culp
 
PDF
Vagrant for Virtualized Development
Adam Culp
 
PDF
Clean application development (talk)
Adam Culp
 
PDF
Using an API
Adam Culp
 
PDF
Puppet and Vagrant in development
Adam Culp
 
PDF
Refactoring PHP
Adam Culp
 
ODP
Selenium testing IDE 101
Adam Culp
 
PPT
Intro to OOP and new features in PHP 5.3
Adam Culp
 
Hypermedia
Adam Culp
 
Putting legacy to REST with middleware
Adam Culp
 
php-1701-a
Adam Culp
 
Release your refactoring superpower
Adam Culp
 
Managing Technical Debt
Adam Culp
 
Developing PHP Applications Faster
Adam Culp
 
Containing Quality
Adam Culp
 
Debugging elephpants
Adam Culp
 
Refactoring Legacy Code
Adam Culp
 
Deprecated: Foundations of Zend Framework 2
Adam Culp
 
Clean application development tutorial
Adam Culp
 
Refactoring 101
Adam Culp
 
Essential git for developers
Adam Culp
 
Vagrant for Virtualized Development
Adam Culp
 
Clean application development (talk)
Adam Culp
 
Using an API
Adam Culp
 
Puppet and Vagrant in development
Adam Culp
 
Refactoring PHP
Adam Culp
 
Selenium testing IDE 101
Adam Culp
 
Intro to OOP and new features in PHP 5.3
Adam Culp
 

Recently uploaded (20)

PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PPTX
Designing Production-Ready AI Agents
Kunal Rai
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
Advancing WebDriver BiDi support in WebKit
Igalia
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
Designing Production-Ready AI Agents
Kunal Rai
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Advancing WebDriver BiDi support in WebKit
Igalia
 

Expressive Microservice Framework Blastoff

  • 1. Expressive Microservice Framework Blastoff By: Adam Culp Twitter: @adamculp https://joind.in/talk/cd0e6
  • 2. 2 Expressive Microservice Framework Blastoff ● About me – OSS Contributor – PHP Certified – Zend Certification Advisory Board – PHP-Fig voting member (IBM i Toolkit) – Consultant at Zend Technologies – Organizer SoFloPHP (South Florida) – Organizer SunshinePHP (Miami) – Long distance (ultra) runner – Photography Enthusiast – Judo Black Belt Instructor
  • 3. 3 Expressive Microservice Framework Blastoff ● About me – OSS Contributor – PHP Certified – Zend Certification Advisory Board – PHP-Fig voting member (IBM i Toolkit) – Consultant at Zend Technologies – Organizer SoFloPHP (South Florida) – Organizer SunshinePHP (Miami) – Long distance (ultra) runner – Photography Enthusiast – Judo Black Belt Instructor I am the PHP Ninja!!!
  • 4. 4 Expressive Microservice Framework Blastoff ● I Help Build The Web
  • 5. 5 Expressive Microservice Framework Blastoff ● Frameworks Suck – Complicated ● Routing ● Databases ● Connectivity ● Communication (HTTP, API) ● Information Container ● GUI (html, javascript, templates, CSS,) ● Errors and Exceptions ● Validation and Cleansing Data ● State
  • 6. 6 Expressive Microservice Framework Blastoff ● Frameworks Web Applications Suck – Complicated ● Routing ● Databases ● Connectivity ● Communication (HTTP, API) ● Information Container ● GUI (html, javascript, templates, CSS,) ● Errors and Exceptions ● Validation and Cleansing Data ● State
  • 7. 7 Expressive Microservice Framework Blastoff ● Buzzword Bingo – We will mention many buzzwords, but...
  • 8. 8 Expressive Microservice Framework Blastoff ● Microservice – All the buzz is “microservices”. – ...complex applications are composed of small, independent processes communicating with each other using language-agnostic APIs. These services are small building blocks, highly decoupled and focused on doing a small task, facilitating a modular approach to system-building. – Wikipedia
  • 9. 9 Expressive Microservice Framework Blastoff ● But in PHP... – How to keep microservices light? – Microservices shouldn’t be heavy I’m a Microservice!!!
  • 10. 10 Expressive Microservice Framework Blastoff ● Full Stack Frameworks Suck – Heavy, bloated, slow – “Lock” you in – “Kitchen Sink” – “You don’t need everything, but its there...”
  • 11. 11 Expressive Microservice Framework Blastoff ● Need For Speed – What does a microservice “need”? ● HTTP message layer ● Routing capabilities ● Dependency injection – IoC – Testable – Swappable pieces ● Templating – Optional (APIs may not need it, except documentation)
  • 12. 12 Expressive Microservice Framework Blastoff ● PHP Ecosystem Facilitators – Composer – Components – Libraries – Containers – Microframeworks – PHP 7
  • 13. 13 Expressive Microservice Framework Blastoff ● All The Things!!! – So many tools: Monolog Whoops Flysystem IBMiToolkit OAuth2 Server https://github.com/ziadoz/awesome-php Expressive
  • 14. 14 Expressive Expressive Microservice Framework Blastoff ● Communication Sucks – Say what!?! Monolog Whoops Flysystem IBMiToolkit OAuth2 Server
  • 15. 15 Expressive Microservice Framework Blastoff ● PSR-15 (preferred) – Part of PHP-Fig.org recommendations – Must implement ● PsrHttpServerMiddlewareMiddlewareInterface ● Middleware dispatching systems must implement – PsrHttpServerMiddlewareDelegateInterface – PSR-7 Double Pass ● PsrHttpMessageMessageInterface – PsrHttpMessageRequestInterface ● PsrHttpMessageServerRequestInterface – PsrHttpMessageResponseInterface ● PsrHttpMessageStreamInterface ● PsrHttpMessageUploadFileInterface ● PsrHttpMessageUriInterface
  • 16. 16 Expressive Microservice Framework Blastoff ● Middleware – ...Middleware makes it easier for software developers to implement communication and input/output, so they can focus on the specific purpose of their application. – Wikipedia – Lighter applications (only what is needed) – Composed of layers
  • 17. 17 Expressive Microservice Framework Blastoff ● Zend Expressive – Microframework built around middleware – Versions ● Version 1 based on PSR-7 ● Version 2 based on PSR-15 – Very lean runtime – Use for building: ● APIs ● Web applications ● Single page sites – Choose your own stack – Great documentation ● https://zendframework.github.io/zend-expressive/
  • 18. 18 Expressive Microservice Framework Blastoff ● Zend Expressive – Not built on Zend Framework, but build by ZF team ● Zend Framework 3 does include some components now ● You choose the stack
  • 19. 19 Expressive Microservice Framework Blastoff ● Composer Install Script – Done right from the start All code available at: https://github.com/adamculp/expressive-blastoff
  • 20. 20 Expressive Microservice Framework Blastoff ● Composer Install Script
  • 21. 21 Expressive Microservice Framework Blastoff ● Composer Install Script – Minimal skeleton or full? ● With or without samples ● Flat or with modules!
  • 22. 22 Expressive Microservice Framework Blastoff ● Composer Install Script – Container options: (container interop) ● Aura.Di ● Pimple ● Zend ServiceManager*
  • 23. 23 Expressive Microservice Framework Blastoff ● Composer Install Script – Router options ● Aura.Router ● FastRoute* ● Zend Router
  • 24. 24 Expressive Microservice Framework Blastoff ● Composer Install Script – Template engine options: ● Plates ● Twig ● Zend View ● None*
  • 25. 25 Expressive Microservice Framework Blastoff ● Composer Install Script – Error handler options: ● Whoops* ● None
  • 26. 26 Expressive Microservice Framework Blastoff ● Structure – Folder structure of Zend Expressive Skeleton
  • 27. 27 Expressive Microservice Framework Blastoff ● Skeleton Application
  • 28. 28 Expressive Microservice Framework Blastoff ● Not MVC – Files and structure focused on Actions
  • 29. 29 Expressive Microservice Framework Blastoff ● The Flow
  • 30. 30 Expressive Microservice Framework Blastoff ● Initial File – Front controller (/public/index.php)
  • 31. 31 Expressive Microservice Framework Blastoff ● Container Creation – We specified Zend ServiceManager (/config/container.php)
  • 32. 32 Expressive Microservice Framework Blastoff ● Load Configs (/config/config.php)
  • 33. 33 Expressive Microservice Framework Blastoff ● Load Configs (/src/App/src/ConfigProvider.php)
  • 34. 34 Expressive Microservice Framework Blastoff ● Load More Configs
  • 35. 35 Expressive Microservice Framework Blastoff ● Load Pipelines – Items to be called as the middleware pipeline. (/config/pipeline.php)
  • 36. 36 Expressive Microservice Framework Blastoff ● Load Pipelines – Items to be called as routed middleware. (/config/routes.php)
  • 37. 37 Expressive Microservice Framework Blastoff ● Action Anatomy – Creates raw JSON response (/src/App/src/Action/PingAction.php)
  • 38. 38 Expressive Microservice Framework Blastoff ● JSON Response – Created by action
  • 39. 39 Expressive Microservice Framework Blastoff ● Let’s Create a Middleware!!!
  • 40. 40 Expressive Microservice Framework Blastoff ● Header Middleware – Create class for new middleware (or include someone else’s)
  • 41. 41 Expressive Microservice Framework Blastoff ● Header Middleware – The class to include the very important header (/src/App/src/Middleware/TheClacksMiddleware.php)
  • 42. 42 Expressive Microservice Framework Blastoff ● Header Middleware – Add the middleware to the pipeline – It will always be included (/config/pipeline.php)
  • 43. 43 Expressive Microservice Framework Blastoff ● Header Middleware – Header for every call now carries our important message
  • 44. 44 Expressive Microservice Framework Blastoff ● Let’s Create a Database Connected Middleware!!! ● With Zend Db
  • 45. 45 Expressive Microservice Framework Blastoff ● Database Connected Example With Zend Db – First we need a database connection. ● Will use Zend-Db for this example, but could be anything. ● Composer to the rescue!
  • 46. 46 Expressive Microservice Framework Blastoff ● Database Connected Example With Zend Db – Specify adapter (via Zend/Db/ConfigProvider() in this case) (/config/config.php)
  • 47. 47 Expressive Microservice Framework Blastoff ● Database Connected Example With Zend Db – Provide local/instance configuration ● This would be driver and credentials ● (credentials not needed with sqlite) (/config/autoload/db.local.php)
  • 48. 48 Expressive Microservice Framework Blastoff ● Database Connected Example With Zend Db – Add the new action to dependencies (/config/autoload/routes.global.php)
  • 49. 49 Expressive Microservice Framework Blastoff ● Database Connected Example With Zend Db – Add the new route to dependencies (/config/routes.php
  • 50. 50 Expressive Microservice Framework Blastoff ● Database Connected Example With Zend Db – Create a factory to pass items needed by the action (/src/App/src/Action/UserListFactory.php)
  • 51. 51 Expressive Microservice Framework Blastoff ● Database Connected Example With Zend Db – Create the action (view 1 of 2 - constructor) (/src/App/src/Action/UserListAction.php)
  • 52. 52 Expressive Microservice Framework Blastoff ● Database Connected Example With Zend Db – Create the action (view 2 of 2 - __invoke method) (/src/App/src/Action/UserListAction.php cont’d)
  • 53. 53 Expressive Microservice Framework Blastoff ● Database Connected Example With Zend Db – Create the view template (/templates/app/user-list.phtml)
  • 54. 54 Expressive Microservice Framework Blastoff ● Database Connected Example With Zend Db – Rejoice!
  • 55. 64 Expressive Microservice Framework Blastoff ● With Zend Expressive: – Easy to build middleware – Lightweight, add what is really needed – Fast – no extra load – Microservices in PHP are better
  • 56. 65 Expressive Microservice Framework Blastoff ● Give Zend Expressive a Try...Today!!! – https://zendframework.github.io/zend-expressive/
  • 57. ● Thank you! ● Code at: https://github.com/adamculp/expressive-blastoff ● Please rate at: https://joind.in/talk/cd0e6 Adam Culp http://www.rungeekradio.com http://www.geekyboy.com Twitter @adamculp Expressive Microservice Framework Blastoff