SlideShare a Scribd company logo
1 of 30
Download to read offline
© 2018 Rogue Wave Software, Inc. All Rights Reserved.
DEVELOPMICROSERVICESDEVELOPMICROSERVICES
INPHPINPHP
by
Senior Software Engineer
Inc.
, Milan (Italy), 30th Nov
Enrico Zimuel
Rogue Wave Software
Codemotion 2018
© 2018 Rogue Wave Software, Inc. All Rights Reserved.
ABOUTMEABOUTME
Developer since 1996
Senior Software Engineer at
Inc.
Open source contributor ,
and
and international speaker
Professor at and
Research Programmer at
Co-founder of (Italy)
Rogue
Wave Software
Apigility
Expressive Zend Framework
TEDx
ITS-ICT Piemonte
Amsterdam
University
PUG Torino
© 2018 Rogue Wave Software, Inc. All Rights Reserved.
BOOK:SVILUPPAREINPHP7BOOK:SVILUPPAREINPHP7
pp. 352, , 2017
ISBN 978-88-481-3120-9
in Italian
www.sviluppareinphp7.it
Tecniche Nuove
© 2018 Rogue Wave Software, Inc. All Rights Reserved.
MICROSERVICEMICROSERVICE
© 2018 Rogue Wave Software, Inc. All Rights Reserved.
...the microservice architectural style is an
approach to developing a single
application as a suite of small services,
each running in its own process and
communicating with lightweight
mechanisms, often an HTTP resource API
- Martin Fowler
© 2018 Rogue Wave Software, Inc. All Rights Reserved.
Source: Introduction to microservices
© 2018 Rogue Wave Software, Inc. All Rights Reserved.
Source: Introduction to microservices
© 2018 Rogue Wave Software, Inc. All Rights Reserved.
BENEFITBENEFIT
Separation of concerns
Modularity
Encapsulation
Scalability
Horizontally scaling
Workload partitioning
© 2018 Rogue Wave Software, Inc. All Rights Reserved.
CONSCONS
Network latency
Debugging
New architecture challenges:
Autodiscovery
Telemetry
Everything needs to be automated
© 2018 Rogue Wave Software, Inc. All Rights Reserved.
PHPPHP
© 2018 Rogue Wave Software, Inc. All Rights Reserved.
MICROSERVICESINPHPMICROSERVICESINPHP
PHP is easy to deploy
PHP 7 is super fast!
Big community
Libraries/Frameworks
Async in PHP (Swoole, ReactPHP, ...)
© 2018 Rogue Wave Software, Inc. All Rights Reserved.
The PHP framework for middleware applications
PSR-7 support (using )
PSR-15 support and piping work ow (using
)
Features: routing, dependency injection, templating,
error handling
Support of out-of-the-box
zend-diactoros
zend-
stratigility
Swoole
© 2018 Rogue Wave Software, Inc. All Rights Reserved.
ABASICWEBAPIABASICWEBAPI
use ZendDiactorosResponseJsonResponse;
use ZendExpressiveApplication;
$container = require 'config/container.php';
$app = $container->get(Application::class);
$app->pipe('/api/ping', function($request) {
return new JsonResponse(['ack' => time()]);
});
// $app->pipe('/api/ping', AppHandlerPingHandler::class);
$app->run();
© 2018 Rogue Wave Software, Inc. All Rights Reserved.
REQUESTHANDLERREQUESTHANDLER
use PsrHttpMessageResponseInterface as Response; // PSR-7
use PsrHttpMessageServerRequestInterface as Request; // PSR-7
use PsrHttpServerRequestHandlerInterface as Handler; // PSR-15
use ZendDiactorosResponseJsonResponse;
class PingHandler implements Handler
{
public function handle(Request $request) : Response
{
return new JsonResponse(['ack' => time()]);
}
}
© 2018 Rogue Wave Software, Inc. All Rights Reserved.
MIDDLEWAREMIDDLEWARE
© 2018 Rogue Wave Software, Inc. All Rights Reserved.
MIDDLEWAREMIDDLEWARE
© 2018 Rogue Wave Software, Inc. All Rights Reserved.
EXAMPLE:AUTHENTICATIONEXAMPLE:AUTHENTICATION
use PsrHttpServerMiddlewareInterface; // PSR-15
class AuthMiddleware implements MiddlewareInterface
{
public function process(Request $request, Handler $handler): Response
{
$user = $this->auth->authenticate($request);
if (null !== $user) {
return $handler->handle($request->withAttribute(
UserInterface::class,
$user
));
}
return $this->auth->unauthorizedResponse($request);
}
}
© 2018 Rogue Wave Software, Inc. All Rights Reserved.
EXAMPLE:ROUTINGRESTAPIEXAMPLE:ROUTINGRESTAPI
$app->route('/api/users[/{id}]', [
AuthenticationAuthenticationMiddleware::class,
AuthorizationAuthorizationMiddleware::class,
ApiActionUserAction::class
], ['GET', 'POST', 'PATCH', 'DELETE'], 'api.users');
// or route each HTTP method
$app->get('/api/users[/{id}]', ..., 'api.users.get');
$app->post('/api/users', ..., 'api.users.post');
$app->patch('/api/users/{id}', ..., 'api.users.patch');
$app->delete('/api/users/{id}', ..., 'api.users.delete');
© 2018 Rogue Wave Software, Inc. All Rights Reserved.
QUICKSTARTQUICKSTART
You can start using Expressive with :composer
composer create-project zendframework/zend-expressive-skeleton <dir>
© 2018 Rogue Wave Software, Inc. All Rights Reserved.
LIBRARIESFORAPILIBRARIESFORAPI
HAL-JSON:
Problem details:
Filtering & validation:
Authentication (HTTP Basic, OAuth2):
Authorization (ACL, RBAC):
zend-expressive-hal
zend-problem-details
zend-input lter
zend-expressive-
authentication
zend-expressive-
authorization
© 2018 Rogue Wave Software, Inc. All Rights Reserved.
SWOOLESWOOLE
© 2018 Rogue Wave Software, Inc. All Rights Reserved.
Swoole is an async programming framework for PHP 7
PHP extension, install:
Released under Apache license 2.0
More info at
pecl install swoole
swoole.co.uk
© 2018 Rogue Wave Software, Inc. All Rights Reserved.
FEATURESFEATURES
Event-driven, asynchronous programming for PHP
Async TCP / UDP / HTTP / Websocket / HTTP2
client/server side API
IPv4 / IPv6 / Unixsocket / TCP/ UDP and SSL / TLS
support
and scalable
Fast serializer / unserializer
Milliseconds task scheduler
High performance
© 2018 Rogue Wave Software, Inc. All Rights Reserved.
SWOOLEVS.PHP-FPMSWOOLEVS.PHP-FPM
Forks a number of worker processes based on CPU
core number
Fupports Long-live connections
Manage and reuse the status in memory
Executes Non-blocking code (async, coroutine)
© 2018 Rogue Wave Software, Inc. All Rights Reserved.
HTTPSERVERHTTPSERVER
use SwooleHttpServer;
$http = new Server("127.0.0.1", 9501);
$http->on("start", function ($server) {
echo "Started at http://127.0.0.1:9501n";
});
$http->on("request", function ($request, $response) {
$response->header("Content-Type", "text/plain");
$response->end("Hello Worldn");
});
$http->start();
Test: 16K req/sec on CPU i5-2500, 16 GB RAM, PHP 7.2.12, Swoole 4.2.9
© 2018 Rogue Wave Software, Inc. All Rights Reserved.
EXPRESSIVEWITHSWOOLEEXPRESSIVEWITHSWOOLE
Install:
composer require zendframework/zend-expressive-swoole
Usage:
vendor/bin/zend-expressive-swoole start
Open your browser at localhost:8080
© 2018 Rogue Wave Software, Inc. All Rights Reserved.
PHP+EXPRESSIVE+SWOOLEPHP+EXPRESSIVE+SWOOLE
Run a web application from CLI
Simplify the deploy (only 1 container)
A web server (nginx) can be used as load balancer
© 2018 Rogue Wave Software, Inc. All Rights Reserved.
BENCHMARKBENCHMARK
2-4x faster than Nginx and Apache
Req/sec (mean)
Nginx 1418.23
Apache 1915.62
Swoole 4864.34
Testing environment:
Ubuntu 18.04, , PHP 7.2.12, Nginx 1.14 + FPM,
Apache 2.4.29 + mod_php, Swoole 4.2.9, CPU i5-2500, 16 GB RAM, HD SSD
Expressive Skeleton 3.2.3
© 2018 Rogue Wave Software, Inc. All Rights Reserved.
REFERENCESREFERENCES
Michael Bryzek, , QCon 2018 talk
, QCon 2016 talk
Martin Fowler, , GOTO 2014 talk
, Nginx blog post
, Nginx ebook (free)
Richard Rodger, , Manning Pubblications, 2017
M.Amundsen, M.McLarty, R.Mitra, I.Nadareishvili,
, O'Reilly Media, 2016
Sam Newman, , O'Reilly Media, 2015
C.P.Sanchez, P.S.Vilariño, , Packt publisher, 2017
M.W.O'Phinney, E.Zimuel, , Zend ebook (free)
Design Microservice Architectures the Right Way
Mastering Chaos - A Net ix Guide to Microservices
Microservices
Introduction to Microservices
Designing and Deploying Microservices
The Tao of microservices
Microservice Architecture: Aligning
Principles, Practices, and Culture
Building Microservices: Designing Fine-Grained Systems
PHP Microservices
Expressive cookbook
© 2018 Rogue Wave Software, Inc. All Rights Reserved.
THANKS!THANKS!
Contact me: enrico.zimuel (at) roguewave.com
Follow me: @ezimuel
This work is licensed under a
.
I used to make this presentation.
Creative Commons Attribution-ShareAlike 3.0 Unported License
reveal.js

More Related Content

What's hot

Cover Your Apps While Still Using npm
Cover Your Apps While Still Using npmCover Your Apps While Still Using npm
Cover Your Apps While Still Using npmTierney Cyren
 
DevSecCon Boston 2018: Building a practical DevSecOps pipeline for free by Je...
DevSecCon Boston 2018: Building a practical DevSecOps pipeline for free by Je...DevSecCon Boston 2018: Building a practical DevSecOps pipeline for free by Je...
DevSecCon Boston 2018: Building a practical DevSecOps pipeline for free by Je...DevSecCon
 
Session: A Reference Architecture for Running Modern APIs with NGINX Unit and...
Session: A Reference Architecture for Running Modern APIs with NGINX Unit and...Session: A Reference Architecture for Running Modern APIs with NGINX Unit and...
Session: A Reference Architecture for Running Modern APIs with NGINX Unit and...NGINX, Inc.
 
Bridging the Security Testing Gap in Your CI/CD Pipeline
Bridging the Security Testing Gap in Your CI/CD PipelineBridging the Security Testing Gap in Your CI/CD Pipeline
Bridging the Security Testing Gap in Your CI/CD PipelineDevOps.com
 
Cybereason - behind the HackingTeam infection server
Cybereason - behind the HackingTeam infection serverCybereason - behind the HackingTeam infection server
Cybereason - behind the HackingTeam infection serverAmit Serper
 
JSCONF 2018 - Baking security into DevOps - a tale of hunting down bugs befor...
JSCONF 2018 - Baking security into DevOps - a tale of hunting down bugs befor...JSCONF 2018 - Baking security into DevOps - a tale of hunting down bugs befor...
JSCONF 2018 - Baking security into DevOps - a tale of hunting down bugs befor...Wouter Bloeyaert
 
Optimizing ModSecurity on NGINX and NGINX Plus
Optimizing ModSecurity on NGINX and NGINX PlusOptimizing ModSecurity on NGINX and NGINX Plus
Optimizing ModSecurity on NGINX and NGINX PlusChristian Folini
 
2020 05-tech saturday-devsecops-#2-v03
2020 05-tech saturday-devsecops-#2-v032020 05-tech saturday-devsecops-#2-v03
2020 05-tech saturday-devsecops-#2-v03Diego Gabriel Cardoso
 
MRA AMA: Ingenious: The Journey to Service Mesh using a Microservices Demo App
MRA AMA: Ingenious: The Journey to Service Mesh using a Microservices Demo AppMRA AMA: Ingenious: The Journey to Service Mesh using a Microservices Demo App
MRA AMA: Ingenious: The Journey to Service Mesh using a Microservices Demo AppNGINX, Inc.
 
Security in the FaaS Lane
Security in the FaaS LaneSecurity in the FaaS Lane
Security in the FaaS LaneJames Wickett
 
Journey to Establish an Open Source Policy in a Fortune 20 Health Care Company
Journey to Establish an Open Source Policy in a Fortune 20 Health Care CompanyJourney to Establish an Open Source Policy in a Fortune 20 Health Care Company
Journey to Establish an Open Source Policy in a Fortune 20 Health Care CompanyAll Things Open
 
JavaOne 2014: Retrofitting OAuth 2.0 Security into Existing REST Services - C...
JavaOne 2014: Retrofitting OAuth 2.0 Security into Existing REST Services - C...JavaOne 2014: Retrofitting OAuth 2.0 Security into Existing REST Services - C...
JavaOne 2014: Retrofitting OAuth 2.0 Security into Existing REST Services - C...ishaigor
 
Release Your Inner DevSecOp
Release Your Inner DevSecOpRelease Your Inner DevSecOp
Release Your Inner DevSecOpJames Wickett
 
Get the Most Out of Kubernetes with NGINX
Get the Most Out of Kubernetes with NGINXGet the Most Out of Kubernetes with NGINX
Get the Most Out of Kubernetes with NGINXNGINX, Inc.
 
Tools &amp; techniques, building a dev secops culture at mozilla sba live a...
Tools &amp; techniques, building a dev secops culture at mozilla   sba live a...Tools &amp; techniques, building a dev secops culture at mozilla   sba live a...
Tools &amp; techniques, building a dev secops culture at mozilla sba live a...SBA Research
 
Stève Sfartz - Meeting rooms are talking! Are you listening? - Codemotion Ber...
Stève Sfartz - Meeting rooms are talking! Are you listening? - Codemotion Ber...Stève Sfartz - Meeting rooms are talking! Are you listening? - Codemotion Ber...
Stève Sfartz - Meeting rooms are talking! Are you listening? - Codemotion Ber...Codemotion
 
CodeFest 2014 - Pentesting client/server API
CodeFest 2014 - Pentesting client/server APICodeFest 2014 - Pentesting client/server API
CodeFest 2014 - Pentesting client/server APISergey Belov
 
OWASP Poland Day 2018 - Amir Shladovsky - Crypto-mining
OWASP Poland Day 2018 - Amir Shladovsky - Crypto-miningOWASP Poland Day 2018 - Amir Shladovsky - Crypto-mining
OWASP Poland Day 2018 - Amir Shladovsky - Crypto-miningOWASP
 

What's hot (20)

Cover Your Apps While Still Using npm
Cover Your Apps While Still Using npmCover Your Apps While Still Using npm
Cover Your Apps While Still Using npm
 
DevSecCon Boston 2018: Building a practical DevSecOps pipeline for free by Je...
DevSecCon Boston 2018: Building a practical DevSecOps pipeline for free by Je...DevSecCon Boston 2018: Building a practical DevSecOps pipeline for free by Je...
DevSecCon Boston 2018: Building a practical DevSecOps pipeline for free by Je...
 
DevSecOps What Why and How
DevSecOps What Why and HowDevSecOps What Why and How
DevSecOps What Why and How
 
Session: A Reference Architecture for Running Modern APIs with NGINX Unit and...
Session: A Reference Architecture for Running Modern APIs with NGINX Unit and...Session: A Reference Architecture for Running Modern APIs with NGINX Unit and...
Session: A Reference Architecture for Running Modern APIs with NGINX Unit and...
 
Bridging the Security Testing Gap in Your CI/CD Pipeline
Bridging the Security Testing Gap in Your CI/CD PipelineBridging the Security Testing Gap in Your CI/CD Pipeline
Bridging the Security Testing Gap in Your CI/CD Pipeline
 
Cybereason - behind the HackingTeam infection server
Cybereason - behind the HackingTeam infection serverCybereason - behind the HackingTeam infection server
Cybereason - behind the HackingTeam infection server
 
JSCONF 2018 - Baking security into DevOps - a tale of hunting down bugs befor...
JSCONF 2018 - Baking security into DevOps - a tale of hunting down bugs befor...JSCONF 2018 - Baking security into DevOps - a tale of hunting down bugs befor...
JSCONF 2018 - Baking security into DevOps - a tale of hunting down bugs befor...
 
Optimizing ModSecurity on NGINX and NGINX Plus
Optimizing ModSecurity on NGINX and NGINX PlusOptimizing ModSecurity on NGINX and NGINX Plus
Optimizing ModSecurity on NGINX and NGINX Plus
 
2020 05-tech saturday-devsecops-#2-v03
2020 05-tech saturday-devsecops-#2-v032020 05-tech saturday-devsecops-#2-v03
2020 05-tech saturday-devsecops-#2-v03
 
MRA AMA: Ingenious: The Journey to Service Mesh using a Microservices Demo App
MRA AMA: Ingenious: The Journey to Service Mesh using a Microservices Demo AppMRA AMA: Ingenious: The Journey to Service Mesh using a Microservices Demo App
MRA AMA: Ingenious: The Journey to Service Mesh using a Microservices Demo App
 
Security in the FaaS Lane
Security in the FaaS LaneSecurity in the FaaS Lane
Security in the FaaS Lane
 
Journey to Establish an Open Source Policy in a Fortune 20 Health Care Company
Journey to Establish an Open Source Policy in a Fortune 20 Health Care CompanyJourney to Establish an Open Source Policy in a Fortune 20 Health Care Company
Journey to Establish an Open Source Policy in a Fortune 20 Health Care Company
 
JavaOne 2014: Retrofitting OAuth 2.0 Security into Existing REST Services - C...
JavaOne 2014: Retrofitting OAuth 2.0 Security into Existing REST Services - C...JavaOne 2014: Retrofitting OAuth 2.0 Security into Existing REST Services - C...
JavaOne 2014: Retrofitting OAuth 2.0 Security into Existing REST Services - C...
 
DevOps or DevSecOps
DevOps or DevSecOpsDevOps or DevSecOps
DevOps or DevSecOps
 
Release Your Inner DevSecOp
Release Your Inner DevSecOpRelease Your Inner DevSecOp
Release Your Inner DevSecOp
 
Get the Most Out of Kubernetes with NGINX
Get the Most Out of Kubernetes with NGINXGet the Most Out of Kubernetes with NGINX
Get the Most Out of Kubernetes with NGINX
 
Tools &amp; techniques, building a dev secops culture at mozilla sba live a...
Tools &amp; techniques, building a dev secops culture at mozilla   sba live a...Tools &amp; techniques, building a dev secops culture at mozilla   sba live a...
Tools &amp; techniques, building a dev secops culture at mozilla sba live a...
 
Stève Sfartz - Meeting rooms are talking! Are you listening? - Codemotion Ber...
Stève Sfartz - Meeting rooms are talking! Are you listening? - Codemotion Ber...Stève Sfartz - Meeting rooms are talking! Are you listening? - Codemotion Ber...
Stève Sfartz - Meeting rooms are talking! Are you listening? - Codemotion Ber...
 
CodeFest 2014 - Pentesting client/server API
CodeFest 2014 - Pentesting client/server APICodeFest 2014 - Pentesting client/server API
CodeFest 2014 - Pentesting client/server API
 
OWASP Poland Day 2018 - Amir Shladovsky - Crypto-mining
OWASP Poland Day 2018 - Amir Shladovsky - Crypto-miningOWASP Poland Day 2018 - Amir Shladovsky - Crypto-mining
OWASP Poland Day 2018 - Amir Shladovsky - Crypto-mining
 

Similar to Develop microservices in php

Speed up web APIs with Expressive and Swoole (PHP Day 2018)
Speed up web APIs with Expressive and Swoole (PHP Day 2018) Speed up web APIs with Expressive and Swoole (PHP Day 2018)
Speed up web APIs with Expressive and Swoole (PHP Day 2018) Zend by Rogue Wave Software
 
Develop web APIs in PHP using middleware with Expressive (Code Europe)
Develop web APIs in PHP using middleware with Expressive (Code Europe)Develop web APIs in PHP using middleware with Expressive (Code Europe)
Develop web APIs in PHP using middleware with Expressive (Code Europe)Zend by Rogue Wave Software
 
DeployR: Revolution R Enterprise with Business Intelligence Applications
DeployR: Revolution R Enterprise with Business Intelligence ApplicationsDeployR: Revolution R Enterprise with Business Intelligence Applications
DeployR: Revolution R Enterprise with Business Intelligence ApplicationsRevolution Analytics
 
Node.js primer for ITE students
Node.js primer for ITE studentsNode.js primer for ITE students
Node.js primer for ITE studentsQuhan Arunasalam
 
Fully Automate Application Delivery with Puppet and F5 - PuppetConf 2014
Fully Automate Application Delivery with Puppet and F5 - PuppetConf 2014Fully Automate Application Delivery with Puppet and F5 - PuppetConf 2014
Fully Automate Application Delivery with Puppet and F5 - PuppetConf 2014Puppet
 
WordCamp LA 2014- Writing Code that Scales
WordCamp LA 2014-  Writing Code that ScalesWordCamp LA 2014-  Writing Code that Scales
WordCamp LA 2014- Writing Code that ScalesSpectrOMTech.com
 
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav DukhinFwdays
 
(Micro?)services architecture in practice
(Micro?)services architecture in practice(Micro?)services architecture in practice
(Micro?)services architecture in practiceThe Software House
 
Nginx: Accelerate Rails, HTTP Tricks
Nginx: Accelerate Rails, HTTP TricksNginx: Accelerate Rails, HTTP Tricks
Nginx: Accelerate Rails, HTTP TricksAdam Wiggins
 
Lets have some fun with twilio open tok
Lets have some fun with   twilio open tokLets have some fun with   twilio open tok
Lets have some fun with twilio open tokmirahman
 
how to use openstack api
how to use openstack apihow to use openstack api
how to use openstack apiLiang Bo
 
Psgi Plack Sfpm
Psgi Plack SfpmPsgi Plack Sfpm
Psgi Plack Sfpmsom_nangia
 

Similar to Develop microservices in php (20)

Speed up web APIs with Expressive and Swoole (PHP Day 2018)
Speed up web APIs with Expressive and Swoole (PHP Day 2018) Speed up web APIs with Expressive and Swoole (PHP Day 2018)
Speed up web APIs with Expressive and Swoole (PHP Day 2018)
 
Building web APIs in PHP with Zend Expressive
Building web APIs in PHP with Zend ExpressiveBuilding web APIs in PHP with Zend Expressive
Building web APIs in PHP with Zend Expressive
 
Node.js Workshop
Node.js WorkshopNode.js Workshop
Node.js Workshop
 
Node.js primer
Node.js primerNode.js primer
Node.js primer
 
Develop web APIs in PHP using middleware with Expressive (Code Europe)
Develop web APIs in PHP using middleware with Expressive (Code Europe)Develop web APIs in PHP using middleware with Expressive (Code Europe)
Develop web APIs in PHP using middleware with Expressive (Code Europe)
 
Sst hackathon express
Sst hackathon expressSst hackathon express
Sst hackathon express
 
DeployR: Revolution R Enterprise with Business Intelligence Applications
DeployR: Revolution R Enterprise with Business Intelligence ApplicationsDeployR: Revolution R Enterprise with Business Intelligence Applications
DeployR: Revolution R Enterprise with Business Intelligence Applications
 
Plack at YAPC::NA 2010
Plack at YAPC::NA 2010Plack at YAPC::NA 2010
Plack at YAPC::NA 2010
 
Node.js primer for ITE students
Node.js primer for ITE studentsNode.js primer for ITE students
Node.js primer for ITE students
 
Plack - LPW 2009
Plack - LPW 2009Plack - LPW 2009
Plack - LPW 2009
 
Fully Automate Application Delivery with Puppet and F5 - PuppetConf 2014
Fully Automate Application Delivery with Puppet and F5 - PuppetConf 2014Fully Automate Application Delivery with Puppet and F5 - PuppetConf 2014
Fully Automate Application Delivery with Puppet and F5 - PuppetConf 2014
 
Mashups
MashupsMashups
Mashups
 
Api Design
Api DesignApi Design
Api Design
 
WordCamp LA 2014- Writing Code that Scales
WordCamp LA 2014-  Writing Code that ScalesWordCamp LA 2014-  Writing Code that Scales
WordCamp LA 2014- Writing Code that Scales
 
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
 
(Micro?)services architecture in practice
(Micro?)services architecture in practice(Micro?)services architecture in practice
(Micro?)services architecture in practice
 
Nginx: Accelerate Rails, HTTP Tricks
Nginx: Accelerate Rails, HTTP TricksNginx: Accelerate Rails, HTTP Tricks
Nginx: Accelerate Rails, HTTP Tricks
 
Lets have some fun with twilio open tok
Lets have some fun with   twilio open tokLets have some fun with   twilio open tok
Lets have some fun with twilio open tok
 
how to use openstack api
how to use openstack apihow to use openstack api
how to use openstack api
 
Psgi Plack Sfpm
Psgi Plack SfpmPsgi Plack Sfpm
Psgi Plack Sfpm
 

More from Zend by Rogue Wave Software

Building and managing applications fast for IBM i
Building and managing applications fast for IBM iBuilding and managing applications fast for IBM i
Building and managing applications fast for IBM iZend by Rogue Wave Software
 
The Sodium crypto library of PHP 7.2 (PHP Day 2018)
The Sodium crypto library of PHP 7.2 (PHP Day 2018)The Sodium crypto library of PHP 7.2 (PHP Day 2018)
The Sodium crypto library of PHP 7.2 (PHP Day 2018)Zend by Rogue Wave Software
 
Fundamentals of performance tuning PHP on IBM i
Fundamentals of performance tuning PHP on IBM i  Fundamentals of performance tuning PHP on IBM i
Fundamentals of performance tuning PHP on IBM i Zend by Rogue Wave Software
 
Standard CMS on standard PHP Stack - Drupal and Zend Server
Standard CMS on standard PHP Stack - Drupal and Zend ServerStandard CMS on standard PHP Stack - Drupal and Zend Server
Standard CMS on standard PHP Stack - Drupal and Zend ServerZend by Rogue Wave Software
 

More from Zend by Rogue Wave Software (20)

Building and managing applications fast for IBM i
Building and managing applications fast for IBM iBuilding and managing applications fast for IBM i
Building and managing applications fast for IBM i
 
To PHP 7 and beyond
To PHP 7 and beyondTo PHP 7 and beyond
To PHP 7 and beyond
 
The Sodium crypto library of PHP 7.2 (PHP Day 2018)
The Sodium crypto library of PHP 7.2 (PHP Day 2018)The Sodium crypto library of PHP 7.2 (PHP Day 2018)
The Sodium crypto library of PHP 7.2 (PHP Day 2018)
 
Middleware web APIs in PHP 7.x
Middleware web APIs in PHP 7.xMiddleware web APIs in PHP 7.x
Middleware web APIs in PHP 7.x
 
Ongoing management of your PHP 7 application
Ongoing management of your PHP 7 applicationOngoing management of your PHP 7 application
Ongoing management of your PHP 7 application
 
Developing web APIs using middleware in PHP 7
Developing web APIs using middleware in PHP 7Developing web APIs using middleware in PHP 7
Developing web APIs using middleware in PHP 7
 
The Docker development template for PHP
The Docker development template for PHPThe Docker development template for PHP
The Docker development template for PHP
 
The most exciting features of PHP 7.1
The most exciting features of PHP 7.1The most exciting features of PHP 7.1
The most exciting features of PHP 7.1
 
Unit testing for project managers
Unit testing for project managersUnit testing for project managers
Unit testing for project managers
 
The new features of PHP 7
The new features of PHP 7The new features of PHP 7
The new features of PHP 7
 
Deploying PHP apps on the cloud
Deploying PHP apps on the cloudDeploying PHP apps on the cloud
Deploying PHP apps on the cloud
 
Data is dead. Long live data!
Data is dead. Long live data! Data is dead. Long live data!
Data is dead. Long live data!
 
Optimizing performance
Optimizing performanceOptimizing performance
Optimizing performance
 
Resolving problems & high availability
Resolving problems & high availabilityResolving problems & high availability
Resolving problems & high availability
 
Developing apps faster
Developing apps fasterDeveloping apps faster
Developing apps faster
 
Keeping up with PHP
Keeping up with PHPKeeping up with PHP
Keeping up with PHP
 
Fundamentals of performance tuning PHP on IBM i
Fundamentals of performance tuning PHP on IBM i  Fundamentals of performance tuning PHP on IBM i
Fundamentals of performance tuning PHP on IBM i
 
Getting started with PHP on IBM i
Getting started with PHP on IBM iGetting started with PHP on IBM i
Getting started with PHP on IBM i
 
Continuous Delivery e-book
Continuous Delivery e-bookContinuous Delivery e-book
Continuous Delivery e-book
 
Standard CMS on standard PHP Stack - Drupal and Zend Server
Standard CMS on standard PHP Stack - Drupal and Zend ServerStandard CMS on standard PHP Stack - Drupal and Zend Server
Standard CMS on standard PHP Stack - Drupal and Zend Server
 

Recently uploaded

What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 

Recently uploaded (20)

What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 

Develop microservices in php

  • 1. © 2018 Rogue Wave Software, Inc. All Rights Reserved. DEVELOPMICROSERVICESDEVELOPMICROSERVICES INPHPINPHP by Senior Software Engineer Inc. , Milan (Italy), 30th Nov Enrico Zimuel Rogue Wave Software Codemotion 2018
  • 2. © 2018 Rogue Wave Software, Inc. All Rights Reserved. ABOUTMEABOUTME Developer since 1996 Senior Software Engineer at Inc. Open source contributor , and and international speaker Professor at and Research Programmer at Co-founder of (Italy) Rogue Wave Software Apigility Expressive Zend Framework TEDx ITS-ICT Piemonte Amsterdam University PUG Torino
  • 3. © 2018 Rogue Wave Software, Inc. All Rights Reserved. BOOK:SVILUPPAREINPHP7BOOK:SVILUPPAREINPHP7 pp. 352, , 2017 ISBN 978-88-481-3120-9 in Italian www.sviluppareinphp7.it Tecniche Nuove
  • 4. © 2018 Rogue Wave Software, Inc. All Rights Reserved. MICROSERVICEMICROSERVICE
  • 5. © 2018 Rogue Wave Software, Inc. All Rights Reserved. ...the microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API - Martin Fowler
  • 6. © 2018 Rogue Wave Software, Inc. All Rights Reserved. Source: Introduction to microservices
  • 7. © 2018 Rogue Wave Software, Inc. All Rights Reserved. Source: Introduction to microservices
  • 8. © 2018 Rogue Wave Software, Inc. All Rights Reserved. BENEFITBENEFIT Separation of concerns Modularity Encapsulation Scalability Horizontally scaling Workload partitioning
  • 9. © 2018 Rogue Wave Software, Inc. All Rights Reserved. CONSCONS Network latency Debugging New architecture challenges: Autodiscovery Telemetry Everything needs to be automated
  • 10. © 2018 Rogue Wave Software, Inc. All Rights Reserved. PHPPHP
  • 11. © 2018 Rogue Wave Software, Inc. All Rights Reserved. MICROSERVICESINPHPMICROSERVICESINPHP PHP is easy to deploy PHP 7 is super fast! Big community Libraries/Frameworks Async in PHP (Swoole, ReactPHP, ...)
  • 12. © 2018 Rogue Wave Software, Inc. All Rights Reserved. The PHP framework for middleware applications PSR-7 support (using ) PSR-15 support and piping work ow (using ) Features: routing, dependency injection, templating, error handling Support of out-of-the-box zend-diactoros zend- stratigility Swoole
  • 13. © 2018 Rogue Wave Software, Inc. All Rights Reserved. ABASICWEBAPIABASICWEBAPI use ZendDiactorosResponseJsonResponse; use ZendExpressiveApplication; $container = require 'config/container.php'; $app = $container->get(Application::class); $app->pipe('/api/ping', function($request) { return new JsonResponse(['ack' => time()]); }); // $app->pipe('/api/ping', AppHandlerPingHandler::class); $app->run();
  • 14. © 2018 Rogue Wave Software, Inc. All Rights Reserved. REQUESTHANDLERREQUESTHANDLER use PsrHttpMessageResponseInterface as Response; // PSR-7 use PsrHttpMessageServerRequestInterface as Request; // PSR-7 use PsrHttpServerRequestHandlerInterface as Handler; // PSR-15 use ZendDiactorosResponseJsonResponse; class PingHandler implements Handler { public function handle(Request $request) : Response { return new JsonResponse(['ack' => time()]); } }
  • 15. © 2018 Rogue Wave Software, Inc. All Rights Reserved. MIDDLEWAREMIDDLEWARE
  • 16. © 2018 Rogue Wave Software, Inc. All Rights Reserved. MIDDLEWAREMIDDLEWARE
  • 17. © 2018 Rogue Wave Software, Inc. All Rights Reserved. EXAMPLE:AUTHENTICATIONEXAMPLE:AUTHENTICATION use PsrHttpServerMiddlewareInterface; // PSR-15 class AuthMiddleware implements MiddlewareInterface { public function process(Request $request, Handler $handler): Response { $user = $this->auth->authenticate($request); if (null !== $user) { return $handler->handle($request->withAttribute( UserInterface::class, $user )); } return $this->auth->unauthorizedResponse($request); } }
  • 18. © 2018 Rogue Wave Software, Inc. All Rights Reserved. EXAMPLE:ROUTINGRESTAPIEXAMPLE:ROUTINGRESTAPI $app->route('/api/users[/{id}]', [ AuthenticationAuthenticationMiddleware::class, AuthorizationAuthorizationMiddleware::class, ApiActionUserAction::class ], ['GET', 'POST', 'PATCH', 'DELETE'], 'api.users'); // or route each HTTP method $app->get('/api/users[/{id}]', ..., 'api.users.get'); $app->post('/api/users', ..., 'api.users.post'); $app->patch('/api/users/{id}', ..., 'api.users.patch'); $app->delete('/api/users/{id}', ..., 'api.users.delete');
  • 19. © 2018 Rogue Wave Software, Inc. All Rights Reserved. QUICKSTARTQUICKSTART You can start using Expressive with :composer composer create-project zendframework/zend-expressive-skeleton <dir>
  • 20. © 2018 Rogue Wave Software, Inc. All Rights Reserved. LIBRARIESFORAPILIBRARIESFORAPI HAL-JSON: Problem details: Filtering & validation: Authentication (HTTP Basic, OAuth2): Authorization (ACL, RBAC): zend-expressive-hal zend-problem-details zend-input lter zend-expressive- authentication zend-expressive- authorization
  • 21. © 2018 Rogue Wave Software, Inc. All Rights Reserved. SWOOLESWOOLE
  • 22. © 2018 Rogue Wave Software, Inc. All Rights Reserved. Swoole is an async programming framework for PHP 7 PHP extension, install: Released under Apache license 2.0 More info at pecl install swoole swoole.co.uk
  • 23. © 2018 Rogue Wave Software, Inc. All Rights Reserved. FEATURESFEATURES Event-driven, asynchronous programming for PHP Async TCP / UDP / HTTP / Websocket / HTTP2 client/server side API IPv4 / IPv6 / Unixsocket / TCP/ UDP and SSL / TLS support and scalable Fast serializer / unserializer Milliseconds task scheduler High performance
  • 24. © 2018 Rogue Wave Software, Inc. All Rights Reserved. SWOOLEVS.PHP-FPMSWOOLEVS.PHP-FPM Forks a number of worker processes based on CPU core number Fupports Long-live connections Manage and reuse the status in memory Executes Non-blocking code (async, coroutine)
  • 25. © 2018 Rogue Wave Software, Inc. All Rights Reserved. HTTPSERVERHTTPSERVER use SwooleHttpServer; $http = new Server("127.0.0.1", 9501); $http->on("start", function ($server) { echo "Started at http://127.0.0.1:9501n"; }); $http->on("request", function ($request, $response) { $response->header("Content-Type", "text/plain"); $response->end("Hello Worldn"); }); $http->start(); Test: 16K req/sec on CPU i5-2500, 16 GB RAM, PHP 7.2.12, Swoole 4.2.9
  • 26. © 2018 Rogue Wave Software, Inc. All Rights Reserved. EXPRESSIVEWITHSWOOLEEXPRESSIVEWITHSWOOLE Install: composer require zendframework/zend-expressive-swoole Usage: vendor/bin/zend-expressive-swoole start Open your browser at localhost:8080
  • 27. © 2018 Rogue Wave Software, Inc. All Rights Reserved. PHP+EXPRESSIVE+SWOOLEPHP+EXPRESSIVE+SWOOLE Run a web application from CLI Simplify the deploy (only 1 container) A web server (nginx) can be used as load balancer
  • 28. © 2018 Rogue Wave Software, Inc. All Rights Reserved. BENCHMARKBENCHMARK 2-4x faster than Nginx and Apache Req/sec (mean) Nginx 1418.23 Apache 1915.62 Swoole 4864.34 Testing environment: Ubuntu 18.04, , PHP 7.2.12, Nginx 1.14 + FPM, Apache 2.4.29 + mod_php, Swoole 4.2.9, CPU i5-2500, 16 GB RAM, HD SSD Expressive Skeleton 3.2.3
  • 29. © 2018 Rogue Wave Software, Inc. All Rights Reserved. REFERENCESREFERENCES Michael Bryzek, , QCon 2018 talk , QCon 2016 talk Martin Fowler, , GOTO 2014 talk , Nginx blog post , Nginx ebook (free) Richard Rodger, , Manning Pubblications, 2017 M.Amundsen, M.McLarty, R.Mitra, I.Nadareishvili, , O'Reilly Media, 2016 Sam Newman, , O'Reilly Media, 2015 C.P.Sanchez, P.S.Vilariño, , Packt publisher, 2017 M.W.O'Phinney, E.Zimuel, , Zend ebook (free) Design Microservice Architectures the Right Way Mastering Chaos - A Net ix Guide to Microservices Microservices Introduction to Microservices Designing and Deploying Microservices The Tao of microservices Microservice Architecture: Aligning Principles, Practices, and Culture Building Microservices: Designing Fine-Grained Systems PHP Microservices Expressive cookbook
  • 30. © 2018 Rogue Wave Software, Inc. All Rights Reserved. THANKS!THANKS! Contact me: enrico.zimuel (at) roguewave.com Follow me: @ezimuel This work is licensed under a . I used to make this presentation. Creative Commons Attribution-ShareAlike 3.0 Unported License reveal.js