SlideShare a Scribd company logo
1 of 81
Zend Expressive Workshop
By:
Adam Culp
Twitter: @adamculp
https://joind.in/talk/ec545
2
Zend Expressive Workshop
●
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
Zend Expressive Workshop
●
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
PHP Ninja!!!
4
Zend Expressive Workshop
●
I Help Build The Web
5
Zend Expressive Workshop
●
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
Zend Expressive Workshop
●
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
Zend Expressive Workshop
●
Buzzword Bingo
– We will mention many buzzwords, but...
8
Zend Expressive Workshop
●
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
Zend Expressive Workshop
●
But in PHP...
– How to keep microservices light?
– Microservices shouldn’t be heavy
I’m a
Microservice!!!
10
Zend Expressive Workshop
●
Full Stack Frameworks Suck
– Heavy and bloated
– “Kitchen Sink”
– “You don’t have to use everything, but its there...”
11
Zend Expressive Workshop
●
Need For Speed
– What does a microservice “need”?
●
HTTP message layer
●
Routing capabilities
●
Dependency injection
– Testable
– Swappable pieces
●
Templating
– Optional (APIs may not need it, except documentation)
12
Zend Expressive Workshop
●
PHP Ecosystem Facilitators
– PHP 7
– Microframeworks
– Libraries
– Components
– Containers
– Composer
13
Zend Expressive Workshop
●
All The Things!!!
– So many tools:
Monolog
Whoops
Flysystem
IBMiToolkit
OAuth2 Server
https://github.com/ziadoz/awesome-php
14
Zend Expressive Workshop
●
Communication Sucks
– Say what!?!
Monolog
Whoops
Flysystem
IBMiToolkit
OAuth2 Server
15
Zend Expressive Workshop
●
PSR-7 Doesn’t Suck
– Part of PHP-Fig.org recommendations
– HTTP Messages
●
Request from client to server
●
Response from server to client
– Interfaces
●
PsrHttpMessageMessageInterface
– PsrHttpMessageRequestInterface
●
PsrHttpMessageServerRequestInterface
– PsrHttpMessageResponseInterface
●
PsrHttpMessageStreamInterface
●
PsrHttpMessageUploadFileInterface
●
PsrHttpMessageUriInterface
16
Zend Expressive Workshop
●
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
Zend Expressive Workshop
●
Zend Expressive
– Microframework built around middleware
– Very lean runtime
– Built to consume PSR-7
– Use for building:
●
APIs
●
Web applications
●
Single page sites
– Choose your own stack
– Great documentation
●
https://zendframework.github.io/zend-expressive/
18
Zend Expressive Workshop
●
Composer Install Script
– Done “right” from the start
19
Zend Expressive Workshop
●
Composer Install Script
20
Zend Expressive Workshop
●
Composer Install Script
– Minimal skeleton or full*?
●
With or without samples
21
Zend Expressive Workshop
●
Composer Install Script
– Router options
●
Aura.Router
●
FastRoute*
●
Zend Router
22
Zend Expressive Workshop
●
Composer Install Script
– Container options: (container interop)
●
Aura.Di
●
Pimple
●
Zend ServiceManager*
23
Zend Expressive Workshop
●
Composer Install Script
– Template engine options:
●
Plates
●
Twig
●
Zend View
●
None*
24
Zend Expressive Workshop
●
Composer Install Script
– Error handler options:
●
Whoops*
●
None
25
Zend Expressive Workshop
●
Lab 01 – Install Zend Expressive
– From within the VM install Zend Expressive
●
At ‘/home/vagrant/workspace/’ delete the ‘expressive’ folder
●
Composer is globally installed in the VM, enabling easy project
creation. (stick to the defaults)
$ composer create-project zendframework/zend-expressive-
skeleton expressive
●
Verify that Zend Expressive Skeleton was properly installed.
http://localhost then click on the Expressive link.→
26
Zend Expressive Workshop
●
Skeleton Application
27
Zend Expressive Workshop
●
Structure
– Folder structure of Zend Expressive Skeleton
28
Zend Expressive Workshop
●
Not MVC
– Files and structure focused on Actions
29
Zend Expressive Workshop
●
Middleware Addition Approaches
– Currently uses a config-driven approach to creating/using middleware
●
Middleware added to services through configuration
– With version 1.1 of Zend Expressive the “recommended” will be
programmatic/explicit approach versus config-driven.
●
Middleware information driven by pipes
●
More on this later
– In this workshop the config-driven approach is used in examples
30
Zend Expressive Workshop
●
The Flow
31
Zend Expressive Workshop
●
Initial File
– Front controller
(/public/index.php)
32
Zend Expressive Workshop
●
Container Creation
– We specified Zend ServiceManager
(/config/container.php)
33
Zend Expressive Workshop
●
Load Configs
(/config/config.php)
34
Zend Expressive Workshop
●
Load Dependencies
– Items to be called as middleware in routes.
(/config/autoload/routes.global.php)
35
Zend Expressive Workshop
●
Load Routes
– Matches path to middleware (Dependencies shown earlier)
(/config/autoload/routes.global.php cont’d)
36
Zend Expressive Workshop
●
Ping Action Anatomy
– Creates raw JSON response
(/src/App/Action/PingAction.php)
37
Zend Expressive Workshop
●
JSON Response
– Created by action
38
Zend Expressive Workshop
●
Lab 02 – REST Test using HTTPie
– Within the VM
●
We will use HTTPie from the command line instead of raw cURL to
make requests.
●
Make a request to the existing ping action we analyzed:
$ http http://expressive/api/ping
●
If doing this from the host browser the URL would be different:
$ http http://expressive:8081/api/ping
●
Observe the response:
– Note the Header information
– Note the json response object
39
Zend Expressive Workshop
●
Lab 02 – REST Test using HTTPie (cont’d)
– Within the VM
●
Observe the response:
– Note the Header information
– Note the json response object
40
Zend Expressive Workshop
●
Let’s Create a Middleware!!!
41
Zend Expressive Workshop
●
Header Middleware
– Create class for new middleware (or include someone else’s)
42
Zend Expressive Workshop
●
Header Middleware
– The class to include the very important header
(/src/App/Middleware/TheClacksMiddleware.php)
43
Zend Expressive Workshop
●
Header Middleware
– Add the middleware to the container
– Set it to always be included
(/config/autoload/middleware-pipeline.global.php)
44
Zend Expressive Workshop
●
Header Middleware
– Header for every call now carries our important message
45
Zend Expressive Workshop
●
Lab 03 – Create a Middleware
– Create middleware to add content into ALL response headers
●
Add an appropriately named middleware class. (Example:
TheClacksMiddleware)
– Define the namespace (Example: ‘AppMiddleware’)
– Use PsrHttpMessageResponseInterface and
ServerRequestInterface.
– Return the response withHeader.
●
Add the new middleware into our middleware services. Remember we
want it to ALL responses.
●
Verify
NOTE: Refer to the expressive-final application if you need hints
46
Zend Expressive Workshop
●
Let’s Create a Database Connected Middleware!!!
●
With Zend Db
47
Zend Expressive Workshop
●
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!
48
Zend Expressive Workshop
●
Database Connected Example With Zend Db
– Specify adapter (provided by Zend/Db/ConfigProvider() in this case)
(/config/autoload/db.global.php)
49
Zend Expressive Workshop
●
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)
50
Zend Expressive Workshop
●
Database Connected Example With Zend Db
– Create the action (view 1 of 2 - constructor)
(/src/App/Action/UserListAction.php)
51
Zend Expressive Workshop
●
Database Connected Example With Zend Db
– Create the action (view 2 of 2 - __invoke method)
(/src/App/Action/UserListAction.php cont’d)
52
Zend Expressive Workshop
●
Database Connected Example With Zend Db
– Create a factory to pass items needed by the action
(/src/App/Action/UserListFactory.php)
53
Zend Expressive Workshop
●
Database Connected Example With Zend Db
– Add the new action to dependencies
(/config/autoload/routes.global.php)
54
Zend Expressive Workshop
●
Database Connected Example With Zend Db
– Add the new route to dependencies
(/config/autoload/routes.global.php cont’d)
55
Zend Expressive Workshop
●
Database Connected Example With Zend Db
– Create the view template
(/templates/app/user-list.phtml)
56
Zend Expressive Workshop
●
Database Connected Example With Zend Db
– Rejoice!
57
Zend Expressive Workshop
●
Lab 04 – Database Connected Middleware
– Create a User middleware allowing management of user records in a
database using Zend Db
●
Using Composer require dependency ‘zendframework/zend-db:2.8.*’
●
Create an autoload global config file to provide
Zend/Db/ConfigProvider
●
Create an autoload local config to provide a db container supplying
the location to the users.db Sqlite database in the /data directory
●
Add an appropriately named middleware class (Example:
UserListAction)
– Define the namespace (Example: ‘AppAction’)
– Use PsrHttpMessageResponseInterface, ServerRequestInterface,
ZendDiactorosResponseHtmlResponse,
ZendExpressiveTemplate, and ZendDbAdapterAdapter.
– Define $template and $adapter fields for those objects
58
Zend Expressive Workshop
●
Lab 04 – Database Connected Middleware (Cont’d)
– Create a User middleware (Cont’d
●
Add a middleware class (Cont’d)
– Add a constructor to receive/set $template and $adapter
●
Typehint $template with TemplateTemplateRendererInterface
– Add an invoke method leveraging ServerRequestInterface,
ResponseInterface, and $next as callable.
– Using the Zend Db adapter create the query for Sqlite.
●
For Sqlite this involves defining a statement, then executing
– Return the HtmlResponse rendering the view template.
●
Add a factory class to prepare the items needed by the Action just
created
– Use InteropContainerContainerInterface,
ZendExpressiveTemplateTemplateRendererInterface, and
ZendDbAdapterAdapterInterface.
59
Zend Expressive Workshop
●
Lab 04 – Database Connected Middleware (Cont’d)
– Create a User middleware (Cont’d
●
Add a factory class (Cont’d)
– Define the namespace (Example: ‘AppAction’)
– In the invoke() method typehint the $container argument using
ContainerInterface.
– Gain the $template if the $container has the
TemplateRenderInterface.
– Gain the DB $adapter also from the $container using
AdapterInterface.
– Return an instantiation of the Action class created earlier by
passing the $template and $adapter.
●
Add the factory to the dependencies in the global routes.
●
Add a route to access the new middleware
●
Create a view template to display the user results.
60
Zend Expressive Workshop
●
Let’s Create Moar Middleware!!!
61
Zend Expressive Workshop
●
Lab 05 – Create Moar Middleware
– Create a uuid middleware to add content into all response headers
●
Using Composer add a dependency ‘ramsey/uuid’
●
Add an appropriately named middleware class. (Example:
UuidMiddleware)
– Define the namespace (Example: ‘AppMiddleware’)
– Use PsrHttpMessageResponseInterface, ServerRequestInterface,
and RamseyUuidUuid (and maybe
RamseyUuidExceptionUnsatisfiedDependencyException).
– Return a uuid in the response withHeader.
●
Add the new middleware into our middleware services. Remember we
want it to ALL responses.
●
Verify
62
Zend Expressive Workshop
●
Lab 05 – Create Moar Middleware (cont’d)
– Continuing… Create middleware to add response time to ALL response
headers
●
Add an appropriately named middleware class. (Example:
RequestTimeMiddleware)
– Define the namespace (Example: ‘AppMiddleware’)
– Use PsrHttpMessageResponseInterface and
ServerRequestInterface.
– Create code returning the time the request took
– Return the response withHeader.
●
Add the new middleware into our middleware services. Remember we
want it to ALL responses.
●
Verify
NOTE: Refer to the expressive-final application if you need hints
63
Zend Expressive Workshop
●
Let’s Create a Database Connected Middleware!!!
●
With Doctrine!!!
64
Zend Expressive Workshop
●
Database Connected Example With Doctrine
– First we need a database connection.
●
Will use Doctrine DBAL for this example, but could be anything.
●
Composer to the rescue!
65
Zend Expressive Workshop
●
Database Connected Example With Doctrine
– Provide local/instance configuration
● This would be driver and credentials
● (credentials not needed with sqlite)
(/config/autoload/dbal.local.php)
66
Zend Expressive Workshop
●
Database Connected Example With Doctrine
– Create the action (view 1 of 2 - constructor)
(/src/App/Action/UserDbalListAction.php)
67
Zend Expressive Workshop
●
Database Connected Example With Doctrine
– Create the action (view 2 of 2 - __invoke method)
(/src/App/Action/UserDbalListAction.php cont’d)
68
Zend Expressive Workshop
●
Database Connected Example With Doctrine
– Create a factory to pass items needed by the action
(/src/App/Action/UserDbalListFactory.php)
69
Zend Expressive Workshop
●
Database Connected Example With Doctrine
– Add the new action to dependencies, as shown below for the previous
action, but with the new namespace for this example
(/config/autoload/routes.global.php)
70
Zend Expressive Workshop
●
Database Connected Example With Doctrine
– Add the new route to dependencies
(/config/autoload/routes.global.php)
71
Zend Expressive Workshop
●
Database Connected Example With Doctrine
– Create the view template
(/templates/app/user-dbal-list.phtml)
72
Zend Expressive Workshop
●
Database Connected Example With Doctrine
– Rejoice!
73
Zend Expressive Workshop
●
Lab 06 – Database Connected Middleware
– Create a User middleware allowing management of user records in a
database using Doctrine Dbal
●
Using Composer require dependency ‘doctrinedbal:2.5.*’
●
Create an autoload local config to provide a doctrine-connection
container supplying the location to the users.db sqlite database in
the /data directory
●
Add an appropriately named middleware class (Example:
UserDbalListAction)
– Define the namespace (Example: ‘AppAction’)
– Use PsrHttpMessageResponseInterface, ServerRequestInterface,
ZendDiactorosResponseHtmlResponse, and
ZendExpressiveTemplate.
– Define $template and $connection fields for those objects
74
Zend Expressive Workshop
●
Lab 06 – Database Connected Middleware (Cont’d)
– Create a User middleware (Cont’d
●
Add a middleware class (Cont’d)
– Add a constructor to receive/set $template and $connection
●
Typehint $template with TemplateTemplateRendererInterface
– Add an invoke method leveraging ServerRequestInterface,
ResponseInterface, and $next as callable.
– Using the Doctrine $connection create the query for Sqlite.
– Return the HtmlResponse rendering the view template.
●
Add a factory class to prepare the items needed by the Action just
created
– Use InteropContainerContainerInterface,
ZendExpressiveTemplateTemplateRendererInterface, and
DoctrineDBALDriverManager.
75
Zend Expressive Workshop
●
Lab 06 – Database Connected Middleware (Cont’d)
– Create a User middleware (Cont’d
●
Add a factory class (Cont’d)
– Define the namespace (Example: ‘AppAction’)
– In the invoke() method typehint the $container argument using
ContainerInterface.
– Gain the $template if the $container has the
TemplateRenderInterface.
– Define the DB $credentials also from the $container and kick off
Doctrine to return the $connection to users for the view to use.
– Return an instantiation of the Action class created earlier by
passing the $template and $connection.
●
Add the factory to the dependencies in the global routes.
●
Add a route to access the new middleware
●
Create a view template to display the user results.
76
Zend Expressive Workshop
●
Let’s Use Programmatic!!!
77
Zend Expressive Workshop
●
Zend Expressive Skeleton Programmatic
– Version 1.1 of Zend Expressive “recommended” approach to adding more
middleware will be with a programmatic/explicit approach.
●
In Github the repo for expressive-final has an additional branch
(name: programmatic) created by Matthew Weier O’Phinney, from the
Zend Expressive team, showing the programmatic approach to
everything in this workshop.
●
https://github.com/adamculp/expressive-workshop
78
Zend Expressive Workshop
●
Resources
– Zend Expressive Site - http://zendframework.github.io/zend-expressive/
– MasterZendFramework - http://www.masterzendframework.com
– Oscar Otero’s list https://github.com/oscarotero/psr7-middlewares
– This github repo https://github.com/adamculp/expressive-workshop
– Slides - http://www.slideshare.net/adamculp/zend-expressive-workshop
– Code used for the workshop - https://github.com/adamculp/expressive-
workshop
– More to come!
79
Zend Expressive Workshop
●
With Zend Expressive:
– Easy to build middleware
– Lightweight, add what is really needed
– Fast – no extra load
– Microservices in PHP are better
80
Zend Expressive Workshop
●
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/ec545
Adam Culp
http://www.rungeekradio.com
http://www.geekyboy.com
Twitter @adamculp

More Related Content

What's hot

Bringing modern PHP development to IBM i (ZendCon 2016)
Bringing modern PHP development to IBM i (ZendCon 2016)Bringing modern PHP development to IBM i (ZendCon 2016)
Bringing modern PHP development to IBM i (ZendCon 2016)James Titcumb
 
Demystifying Object-Oriented Programming - ZendCon 2016
Demystifying Object-Oriented Programming - ZendCon 2016Demystifying Object-Oriented Programming - ZendCon 2016
Demystifying Object-Oriented Programming - ZendCon 2016Alena Holligan
 
Deploying Perl apps on dotCloud
Deploying Perl apps on dotCloudDeploying Perl apps on dotCloud
Deploying Perl apps on dotClouddaoswald
 
PHP 7 Crash Course - php[world] 2015
PHP 7 Crash Course - php[world] 2015PHP 7 Crash Course - php[world] 2015
PHP 7 Crash Course - php[world] 2015Colin O'Dell
 
PHP7 - The New Engine for old good train
PHP7 - The New Engine for old good trainPHP7 - The New Engine for old good train
PHP7 - The New Engine for old good trainXinchen Hui
 
Zend Framework 2 Components
Zend Framework 2 ComponentsZend Framework 2 Components
Zend Framework 2 ComponentsShawn Stratton
 
30 Minutes To CPAN
30 Minutes To CPAN30 Minutes To CPAN
30 Minutes To CPANdaoswald
 
Submit PHP: Standards in PHP world. Михайло Морозов
Submit PHP: Standards in PHP world. Михайло МорозовSubmit PHP: Standards in PHP world. Михайло Морозов
Submit PHP: Standards in PHP world. Михайло МорозовBinary Studio
 
Php internal architecture
Php internal architecturePhp internal architecture
Php internal architectureElizabeth Smith
 
Zend con 2016 bdd with behat for beginners
Zend con 2016   bdd with behat for beginnersZend con 2016   bdd with behat for beginners
Zend con 2016 bdd with behat for beginnersAdam Englander
 
Plack perl superglue for web frameworks and servers
Plack perl superglue for web frameworks and serversPlack perl superglue for web frameworks and servers
Plack perl superglue for web frameworks and serversTatsuhiko Miyagawa
 
Information security programming in ruby
Information security programming in rubyInformation security programming in ruby
Information security programming in rubyHiroshi Nakamura
 
Power shell training
Power shell trainingPower shell training
Power shell trainingDavid Brabant
 
Writing php extensions in golang
Writing php extensions in golangWriting php extensions in golang
Writing php extensions in golangdo_aki
 
Modern Black Mages Fighting in the Real World
Modern Black Mages Fighting in the Real WorldModern Black Mages Fighting in the Real World
Modern Black Mages Fighting in the Real WorldSATOSHI TAGOMORI
 
Php7 傳說中的第七隻大象
Php7 傳說中的第七隻大象Php7 傳說中的第七隻大象
Php7 傳說中的第七隻大象bobo52310
 
PyCon Korea 2019 REST API Document Generation
PyCon Korea 2019 REST API Document GenerationPyCon Korea 2019 REST API Document Generation
PyCon Korea 2019 REST API Document Generation용선 이
 
Modern Web Development with Perl
Modern Web Development with PerlModern Web Development with Perl
Modern Web Development with PerlDave Cross
 

What's hot (20)

Bringing modern PHP development to IBM i (ZendCon 2016)
Bringing modern PHP development to IBM i (ZendCon 2016)Bringing modern PHP development to IBM i (ZendCon 2016)
Bringing modern PHP development to IBM i (ZendCon 2016)
 
Demystifying Object-Oriented Programming - ZendCon 2016
Demystifying Object-Oriented Programming - ZendCon 2016Demystifying Object-Oriented Programming - ZendCon 2016
Demystifying Object-Oriented Programming - ZendCon 2016
 
Deploying Perl apps on dotCloud
Deploying Perl apps on dotCloudDeploying Perl apps on dotCloud
Deploying Perl apps on dotCloud
 
PHP 7 Crash Course - php[world] 2015
PHP 7 Crash Course - php[world] 2015PHP 7 Crash Course - php[world] 2015
PHP 7 Crash Course - php[world] 2015
 
PHP7 - The New Engine for old good train
PHP7 - The New Engine for old good trainPHP7 - The New Engine for old good train
PHP7 - The New Engine for old good train
 
Zend Framework 2 Components
Zend Framework 2 ComponentsZend Framework 2 Components
Zend Framework 2 Components
 
30 Minutes To CPAN
30 Minutes To CPAN30 Minutes To CPAN
30 Minutes To CPAN
 
PHP Development Tools
PHP  Development ToolsPHP  Development Tools
PHP Development Tools
 
Submit PHP: Standards in PHP world. Михайло Морозов
Submit PHP: Standards in PHP world. Михайло МорозовSubmit PHP: Standards in PHP world. Михайло Морозов
Submit PHP: Standards in PHP world. Михайло Морозов
 
Php internal architecture
Php internal architecturePhp internal architecture
Php internal architecture
 
Zend con 2016 bdd with behat for beginners
Zend con 2016   bdd with behat for beginnersZend con 2016   bdd with behat for beginners
Zend con 2016 bdd with behat for beginners
 
Plack perl superglue for web frameworks and servers
Plack perl superglue for web frameworks and serversPlack perl superglue for web frameworks and servers
Plack perl superglue for web frameworks and servers
 
Information security programming in ruby
Information security programming in rubyInformation security programming in ruby
Information security programming in ruby
 
Power shell training
Power shell trainingPower shell training
Power shell training
 
Plack at YAPC::NA 2010
Plack at YAPC::NA 2010Plack at YAPC::NA 2010
Plack at YAPC::NA 2010
 
Writing php extensions in golang
Writing php extensions in golangWriting php extensions in golang
Writing php extensions in golang
 
Modern Black Mages Fighting in the Real World
Modern Black Mages Fighting in the Real WorldModern Black Mages Fighting in the Real World
Modern Black Mages Fighting in the Real World
 
Php7 傳說中的第七隻大象
Php7 傳說中的第七隻大象Php7 傳說中的第七隻大象
Php7 傳說中的第七隻大象
 
PyCon Korea 2019 REST API Document Generation
PyCon Korea 2019 REST API Document GenerationPyCon Korea 2019 REST API Document Generation
PyCon Korea 2019 REST API Document Generation
 
Modern Web Development with Perl
Modern Web Development with PerlModern Web Development with Perl
Modern Web Development with Perl
 

Viewers also liked

Zend Expressive in 15 Minutes
Zend Expressive in 15 MinutesZend Expressive in 15 Minutes
Zend Expressive in 15 MinutesChris Tankersley
 
Accidental professional
Accidental professionalAccidental professional
Accidental professionalAdam Culp
 
Refactoring Legacy Code
Refactoring Legacy CodeRefactoring Legacy Code
Refactoring Legacy CodeAdam Culp
 
Docker for PHP Developers (NomadPHP)
Docker for PHP Developers (NomadPHP)Docker for PHP Developers (NomadPHP)
Docker for PHP Developers (NomadPHP)Chris Tankersley
 
Zend framework 3 と zend expressive の話
Zend framework 3 と zend expressive の話Zend framework 3 と zend expressive の話
Zend framework 3 と zend expressive の話Satoru Yoshida
 
Does Your Code Measure Up?
Does Your Code Measure Up?Does Your Code Measure Up?
Does Your Code Measure Up?Adam Culp
 
Build great products
Build great productsBuild great products
Build great productsAdam Culp
 
Practical PHP Deployment with Jenkins
Practical PHP Deployment with JenkinsPractical PHP Deployment with Jenkins
Practical PHP Deployment with JenkinsAdam Culp
 
Refactoring 101
Refactoring 101Refactoring 101
Refactoring 101Adam Culp
 

Viewers also liked (11)

Zend Expressive in 15 Minutes
Zend Expressive in 15 MinutesZend Expressive in 15 Minutes
Zend Expressive in 15 Minutes
 
Accidental professional
Accidental professionalAccidental professional
Accidental professional
 
Refactoring Legacy Code
Refactoring Legacy CodeRefactoring Legacy Code
Refactoring Legacy Code
 
Docker for PHP Developers (NomadPHP)
Docker for PHP Developers (NomadPHP)Docker for PHP Developers (NomadPHP)
Docker for PHP Developers (NomadPHP)
 
Zend framework 3 と zend expressive の話
Zend framework 3 と zend expressive の話Zend framework 3 と zend expressive の話
Zend framework 3 と zend expressive の話
 
Does Your Code Measure Up?
Does Your Code Measure Up?Does Your Code Measure Up?
Does Your Code Measure Up?
 
Build great products
Build great productsBuild great products
Build great products
 
Practical PHP Deployment with Jenkins
Practical PHP Deployment with JenkinsPractical PHP Deployment with Jenkins
Practical PHP Deployment with Jenkins
 
Refactoring 101
Refactoring 101Refactoring 101
Refactoring 101
 
Twig tips and tricks
Twig tips and tricksTwig tips and tricks
Twig tips and tricks
 
reveal.js 3.0.0
reveal.js 3.0.0reveal.js 3.0.0
reveal.js 3.0.0
 

Similar to Zend expressive workshop

PHP - Programming language war, does it matter
PHP - Programming language war, does it matterPHP - Programming language war, does it matter
PHP - Programming language war, does it matterMizno Kruge
 
Introduction to PHP (SDPHP)
Introduction to PHP   (SDPHP)Introduction to PHP   (SDPHP)
Introduction to PHP (SDPHP)Eric Johnson
 
The PHP mysqlnd plugin talk - plugins an alternative to MySQL Proxy
The PHP mysqlnd plugin talk - plugins an alternative to MySQL ProxyThe PHP mysqlnd plugin talk - plugins an alternative to MySQL Proxy
The PHP mysqlnd plugin talk - plugins an alternative to MySQL ProxyUlf Wendel
 
Best Practices in PHP Application Deployment
Best Practices in PHP Application DeploymentBest Practices in PHP Application Deployment
Best Practices in PHP Application DeploymentShahar Evron
 
Slides from LAX & DEN usergroup meetings
Slides from LAX & DEN usergroup meetingsSlides from LAX & DEN usergroup meetings
Slides from LAX & DEN usergroup meetings10n Software, LLC
 
Php7 extensions workshop
Php7 extensions workshopPhp7 extensions workshop
Php7 extensions workshopjulien pauli
 
PhpStorm: Symfony2 Plugin
PhpStorm: Symfony2 PluginPhpStorm: Symfony2 Plugin
PhpStorm: Symfony2 PluginHaehnchen
 
Using Zend_Tool to Establish Your Project's Skeleton
Using Zend_Tool to Establish Your Project's SkeletonUsing Zend_Tool to Establish Your Project's Skeleton
Using Zend_Tool to Establish Your Project's SkeletonJeremy Brown
 
Behat Workshop at WeLovePHP
Behat Workshop at WeLovePHPBehat Workshop at WeLovePHP
Behat Workshop at WeLovePHPMarcos Quesada
 
Using the new WordPress REST API
Using the new WordPress REST APIUsing the new WordPress REST API
Using the new WordPress REST APICaldera Labs
 
(phpconftw2012) PHP as a Middleware in Embedded Systems
(phpconftw2012) PHP as a Middleware in Embedded Systems(phpconftw2012) PHP as a Middleware in Embedded Systems
(phpconftw2012) PHP as a Middleware in Embedded Systemssosorry
 
Zend con practical-zf1-zf2-migration
Zend con practical-zf1-zf2-migrationZend con practical-zf1-zf2-migration
Zend con practical-zf1-zf2-migrationClark Everetts
 
Applying software engineering to configuration management
Applying software engineering to configuration managementApplying software engineering to configuration management
Applying software engineering to configuration managementBart Vanbrabant
 

Similar to Zend expressive workshop (20)

PHP - Programming language war, does it matter
PHP - Programming language war, does it matterPHP - Programming language war, does it matter
PHP - Programming language war, does it matter
 
Introduction to PHP (SDPHP)
Introduction to PHP   (SDPHP)Introduction to PHP   (SDPHP)
Introduction to PHP (SDPHP)
 
Zend Framework Workshop
Zend Framework WorkshopZend Framework Workshop
Zend Framework Workshop
 
The PHP mysqlnd plugin talk - plugins an alternative to MySQL Proxy
The PHP mysqlnd plugin talk - plugins an alternative to MySQL ProxyThe PHP mysqlnd plugin talk - plugins an alternative to MySQL Proxy
The PHP mysqlnd plugin talk - plugins an alternative to MySQL Proxy
 
Best Practices in PHP Application Deployment
Best Practices in PHP Application DeploymentBest Practices in PHP Application Deployment
Best Practices in PHP Application Deployment
 
Slides from LAX & DEN usergroup meetings
Slides from LAX & DEN usergroup meetingsSlides from LAX & DEN usergroup meetings
Slides from LAX & DEN usergroup meetings
 
Php7 extensions workshop
Php7 extensions workshopPhp7 extensions workshop
Php7 extensions workshop
 
PhpStorm: Symfony2 Plugin
PhpStorm: Symfony2 PluginPhpStorm: Symfony2 Plugin
PhpStorm: Symfony2 Plugin
 
Using Zend_Tool to Establish Your Project's Skeleton
Using Zend_Tool to Establish Your Project's SkeletonUsing Zend_Tool to Establish Your Project's Skeleton
Using Zend_Tool to Establish Your Project's Skeleton
 
Behat Workshop at WeLovePHP
Behat Workshop at WeLovePHPBehat Workshop at WeLovePHP
Behat Workshop at WeLovePHP
 
Using the new WordPress REST API
Using the new WordPress REST APIUsing the new WordPress REST API
Using the new WordPress REST API
 
(phpconftw2012) PHP as a Middleware in Embedded Systems
(phpconftw2012) PHP as a Middleware in Embedded Systems(phpconftw2012) PHP as a Middleware in Embedded Systems
(phpconftw2012) PHP as a Middleware in Embedded Systems
 
Zend con practical-zf1-zf2-migration
Zend con practical-zf1-zf2-migrationZend con practical-zf1-zf2-migration
Zend con practical-zf1-zf2-migration
 
Demo
DemoDemo
Demo
 
Applying software engineering to configuration management
Applying software engineering to configuration managementApplying software engineering to configuration management
Applying software engineering to configuration management
 
first pitch
first pitchfirst pitch
first pitch
 
werwr
werwrwerwr
werwr
 
sdfsdf
sdfsdfsdfsdf
sdfsdf
 
college
collegecollege
college
 
first pitch
first pitchfirst pitch
first pitch
 

More from Adam Culp

Putting legacy to REST with middleware
Putting legacy to REST with middlewarePutting legacy to REST with middleware
Putting legacy to REST with middlewareAdam Culp
 
Release your refactoring superpower
Release your refactoring superpowerRelease your refactoring superpower
Release your refactoring superpowerAdam Culp
 
Managing Technical Debt
Managing Technical DebtManaging Technical Debt
Managing Technical DebtAdam Culp
 
Developing PHP Applications Faster
Developing PHP Applications FasterDeveloping PHP Applications Faster
Developing PHP Applications FasterAdam Culp
 
Containing Quality
Containing QualityContaining Quality
Containing QualityAdam Culp
 
Debugging elephpants
Debugging elephpantsDebugging elephpants
Debugging elephpantsAdam Culp
 
Deprecated: Foundations of Zend Framework 2
Deprecated: Foundations of Zend Framework 2Deprecated: Foundations of Zend Framework 2
Deprecated: Foundations of Zend Framework 2Adam Culp
 
Clean application development tutorial
Clean application development tutorialClean application development tutorial
Clean application development tutorialAdam Culp
 
Essential git for developers
Essential git for developersEssential git for developers
Essential git for developersAdam Culp
 
Vagrant for Virtualized Development
Vagrant for Virtualized DevelopmentVagrant for Virtualized Development
Vagrant for Virtualized DevelopmentAdam Culp
 
Clean application development (talk)
Clean application development (talk)Clean application development (talk)
Clean application development (talk)Adam Culp
 
Using an API
Using an APIUsing an API
Using an APIAdam Culp
 
Puppet and Vagrant in development
Puppet and Vagrant in developmentPuppet and Vagrant in development
Puppet and Vagrant in developmentAdam Culp
 
Refactoring PHP
Refactoring PHPRefactoring PHP
Refactoring PHPAdam Culp
 
Selenium testing IDE 101
Selenium testing IDE 101Selenium testing IDE 101
Selenium testing IDE 101Adam Culp
 
Intro to OOP and new features in PHP 5.3
Intro to OOP and new features in PHP 5.3Intro to OOP and new features in PHP 5.3
Intro to OOP and new features in PHP 5.3Adam Culp
 
Development Environment Tips
Development Environment TipsDevelopment Environment Tips
Development Environment TipsAdam Culp
 
Getting your project_started
Getting your project_startedGetting your project_started
Getting your project_startedAdam Culp
 

More from Adam Culp (20)

Hypermedia
HypermediaHypermedia
Hypermedia
 
Putting legacy to REST with middleware
Putting legacy to REST with middlewarePutting legacy to REST with middleware
Putting legacy to REST with middleware
 
php-1701-a
php-1701-aphp-1701-a
php-1701-a
 
Release your refactoring superpower
Release your refactoring superpowerRelease your refactoring superpower
Release your refactoring superpower
 
Managing Technical Debt
Managing Technical DebtManaging Technical Debt
Managing Technical Debt
 
Developing PHP Applications Faster
Developing PHP Applications FasterDeveloping PHP Applications Faster
Developing PHP Applications Faster
 
Containing Quality
Containing QualityContaining Quality
Containing Quality
 
Debugging elephpants
Debugging elephpantsDebugging elephpants
Debugging elephpants
 
Deprecated: Foundations of Zend Framework 2
Deprecated: Foundations of Zend Framework 2Deprecated: Foundations of Zend Framework 2
Deprecated: Foundations of Zend Framework 2
 
Clean application development tutorial
Clean application development tutorialClean application development tutorial
Clean application development tutorial
 
Essential git for developers
Essential git for developersEssential git for developers
Essential git for developers
 
Vagrant for Virtualized Development
Vagrant for Virtualized DevelopmentVagrant for Virtualized Development
Vagrant for Virtualized Development
 
Clean application development (talk)
Clean application development (talk)Clean application development (talk)
Clean application development (talk)
 
Using an API
Using an APIUsing an API
Using an API
 
Puppet and Vagrant in development
Puppet and Vagrant in developmentPuppet and Vagrant in development
Puppet and Vagrant in development
 
Refactoring PHP
Refactoring PHPRefactoring PHP
Refactoring PHP
 
Selenium testing IDE 101
Selenium testing IDE 101Selenium testing IDE 101
Selenium testing IDE 101
 
Intro to OOP and new features in PHP 5.3
Intro to OOP and new features in PHP 5.3Intro to OOP and new features in PHP 5.3
Intro to OOP and new features in PHP 5.3
 
Development Environment Tips
Development Environment TipsDevelopment Environment Tips
Development Environment Tips
 
Getting your project_started
Getting your project_startedGetting your project_started
Getting your project_started
 

Recently uploaded

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 

Recently uploaded (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

Zend expressive workshop

  • 1. Zend Expressive Workshop By: Adam Culp Twitter: @adamculp https://joind.in/talk/ec545
  • 2. 2 Zend Expressive Workshop ● 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 Zend Expressive Workshop ● 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 PHP Ninja!!!
  • 4. 4 Zend Expressive Workshop ● I Help Build The Web
  • 5. 5 Zend Expressive Workshop ● 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 Zend Expressive Workshop ● 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 Zend Expressive Workshop ● Buzzword Bingo – We will mention many buzzwords, but...
  • 8. 8 Zend Expressive Workshop ● 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 Zend Expressive Workshop ● But in PHP... – How to keep microservices light? – Microservices shouldn’t be heavy I’m a Microservice!!!
  • 10. 10 Zend Expressive Workshop ● Full Stack Frameworks Suck – Heavy and bloated – “Kitchen Sink” – “You don’t have to use everything, but its there...”
  • 11. 11 Zend Expressive Workshop ● Need For Speed – What does a microservice “need”? ● HTTP message layer ● Routing capabilities ● Dependency injection – Testable – Swappable pieces ● Templating – Optional (APIs may not need it, except documentation)
  • 12. 12 Zend Expressive Workshop ● PHP Ecosystem Facilitators – PHP 7 – Microframeworks – Libraries – Components – Containers – Composer
  • 13. 13 Zend Expressive Workshop ● All The Things!!! – So many tools: Monolog Whoops Flysystem IBMiToolkit OAuth2 Server https://github.com/ziadoz/awesome-php
  • 14. 14 Zend Expressive Workshop ● Communication Sucks – Say what!?! Monolog Whoops Flysystem IBMiToolkit OAuth2 Server
  • 15. 15 Zend Expressive Workshop ● PSR-7 Doesn’t Suck – Part of PHP-Fig.org recommendations – HTTP Messages ● Request from client to server ● Response from server to client – Interfaces ● PsrHttpMessageMessageInterface – PsrHttpMessageRequestInterface ● PsrHttpMessageServerRequestInterface – PsrHttpMessageResponseInterface ● PsrHttpMessageStreamInterface ● PsrHttpMessageUploadFileInterface ● PsrHttpMessageUriInterface
  • 16. 16 Zend Expressive Workshop ● 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 Zend Expressive Workshop ● Zend Expressive – Microframework built around middleware – Very lean runtime – Built to consume PSR-7 – Use for building: ● APIs ● Web applications ● Single page sites – Choose your own stack – Great documentation ● https://zendframework.github.io/zend-expressive/
  • 18. 18 Zend Expressive Workshop ● Composer Install Script – Done “right” from the start
  • 20. 20 Zend Expressive Workshop ● Composer Install Script – Minimal skeleton or full*? ● With or without samples
  • 21. 21 Zend Expressive Workshop ● Composer Install Script – Router options ● Aura.Router ● FastRoute* ● Zend Router
  • 22. 22 Zend Expressive Workshop ● Composer Install Script – Container options: (container interop) ● Aura.Di ● Pimple ● Zend ServiceManager*
  • 23. 23 Zend Expressive Workshop ● Composer Install Script – Template engine options: ● Plates ● Twig ● Zend View ● None*
  • 24. 24 Zend Expressive Workshop ● Composer Install Script – Error handler options: ● Whoops* ● None
  • 25. 25 Zend Expressive Workshop ● Lab 01 – Install Zend Expressive – From within the VM install Zend Expressive ● At ‘/home/vagrant/workspace/’ delete the ‘expressive’ folder ● Composer is globally installed in the VM, enabling easy project creation. (stick to the defaults) $ composer create-project zendframework/zend-expressive- skeleton expressive ● Verify that Zend Expressive Skeleton was properly installed. http://localhost then click on the Expressive link.→
  • 27. 27 Zend Expressive Workshop ● Structure – Folder structure of Zend Expressive Skeleton
  • 28. 28 Zend Expressive Workshop ● Not MVC – Files and structure focused on Actions
  • 29. 29 Zend Expressive Workshop ● Middleware Addition Approaches – Currently uses a config-driven approach to creating/using middleware ● Middleware added to services through configuration – With version 1.1 of Zend Expressive the “recommended” will be programmatic/explicit approach versus config-driven. ● Middleware information driven by pipes ● More on this later – In this workshop the config-driven approach is used in examples
  • 31. 31 Zend Expressive Workshop ● Initial File – Front controller (/public/index.php)
  • 32. 32 Zend Expressive Workshop ● Container Creation – We specified Zend ServiceManager (/config/container.php)
  • 33. 33 Zend Expressive Workshop ● Load Configs (/config/config.php)
  • 34. 34 Zend Expressive Workshop ● Load Dependencies – Items to be called as middleware in routes. (/config/autoload/routes.global.php)
  • 35. 35 Zend Expressive Workshop ● Load Routes – Matches path to middleware (Dependencies shown earlier) (/config/autoload/routes.global.php cont’d)
  • 36. 36 Zend Expressive Workshop ● Ping Action Anatomy – Creates raw JSON response (/src/App/Action/PingAction.php)
  • 37. 37 Zend Expressive Workshop ● JSON Response – Created by action
  • 38. 38 Zend Expressive Workshop ● Lab 02 – REST Test using HTTPie – Within the VM ● We will use HTTPie from the command line instead of raw cURL to make requests. ● Make a request to the existing ping action we analyzed: $ http http://expressive/api/ping ● If doing this from the host browser the URL would be different: $ http http://expressive:8081/api/ping ● Observe the response: – Note the Header information – Note the json response object
  • 39. 39 Zend Expressive Workshop ● Lab 02 – REST Test using HTTPie (cont’d) – Within the VM ● Observe the response: – Note the Header information – Note the json response object
  • 40. 40 Zend Expressive Workshop ● Let’s Create a Middleware!!!
  • 41. 41 Zend Expressive Workshop ● Header Middleware – Create class for new middleware (or include someone else’s)
  • 42. 42 Zend Expressive Workshop ● Header Middleware – The class to include the very important header (/src/App/Middleware/TheClacksMiddleware.php)
  • 43. 43 Zend Expressive Workshop ● Header Middleware – Add the middleware to the container – Set it to always be included (/config/autoload/middleware-pipeline.global.php)
  • 44. 44 Zend Expressive Workshop ● Header Middleware – Header for every call now carries our important message
  • 45. 45 Zend Expressive Workshop ● Lab 03 – Create a Middleware – Create middleware to add content into ALL response headers ● Add an appropriately named middleware class. (Example: TheClacksMiddleware) – Define the namespace (Example: ‘AppMiddleware’) – Use PsrHttpMessageResponseInterface and ServerRequestInterface. – Return the response withHeader. ● Add the new middleware into our middleware services. Remember we want it to ALL responses. ● Verify NOTE: Refer to the expressive-final application if you need hints
  • 46. 46 Zend Expressive Workshop ● Let’s Create a Database Connected Middleware!!! ● With Zend Db
  • 47. 47 Zend Expressive Workshop ● 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!
  • 48. 48 Zend Expressive Workshop ● Database Connected Example With Zend Db – Specify adapter (provided by Zend/Db/ConfigProvider() in this case) (/config/autoload/db.global.php)
  • 49. 49 Zend Expressive Workshop ● 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)
  • 50. 50 Zend Expressive Workshop ● Database Connected Example With Zend Db – Create the action (view 1 of 2 - constructor) (/src/App/Action/UserListAction.php)
  • 51. 51 Zend Expressive Workshop ● Database Connected Example With Zend Db – Create the action (view 2 of 2 - __invoke method) (/src/App/Action/UserListAction.php cont’d)
  • 52. 52 Zend Expressive Workshop ● Database Connected Example With Zend Db – Create a factory to pass items needed by the action (/src/App/Action/UserListFactory.php)
  • 53. 53 Zend Expressive Workshop ● Database Connected Example With Zend Db – Add the new action to dependencies (/config/autoload/routes.global.php)
  • 54. 54 Zend Expressive Workshop ● Database Connected Example With Zend Db – Add the new route to dependencies (/config/autoload/routes.global.php cont’d)
  • 55. 55 Zend Expressive Workshop ● Database Connected Example With Zend Db – Create the view template (/templates/app/user-list.phtml)
  • 56. 56 Zend Expressive Workshop ● Database Connected Example With Zend Db – Rejoice!
  • 57. 57 Zend Expressive Workshop ● Lab 04 – Database Connected Middleware – Create a User middleware allowing management of user records in a database using Zend Db ● Using Composer require dependency ‘zendframework/zend-db:2.8.*’ ● Create an autoload global config file to provide Zend/Db/ConfigProvider ● Create an autoload local config to provide a db container supplying the location to the users.db Sqlite database in the /data directory ● Add an appropriately named middleware class (Example: UserListAction) – Define the namespace (Example: ‘AppAction’) – Use PsrHttpMessageResponseInterface, ServerRequestInterface, ZendDiactorosResponseHtmlResponse, ZendExpressiveTemplate, and ZendDbAdapterAdapter. – Define $template and $adapter fields for those objects
  • 58. 58 Zend Expressive Workshop ● Lab 04 – Database Connected Middleware (Cont’d) – Create a User middleware (Cont’d ● Add a middleware class (Cont’d) – Add a constructor to receive/set $template and $adapter ● Typehint $template with TemplateTemplateRendererInterface – Add an invoke method leveraging ServerRequestInterface, ResponseInterface, and $next as callable. – Using the Zend Db adapter create the query for Sqlite. ● For Sqlite this involves defining a statement, then executing – Return the HtmlResponse rendering the view template. ● Add a factory class to prepare the items needed by the Action just created – Use InteropContainerContainerInterface, ZendExpressiveTemplateTemplateRendererInterface, and ZendDbAdapterAdapterInterface.
  • 59. 59 Zend Expressive Workshop ● Lab 04 – Database Connected Middleware (Cont’d) – Create a User middleware (Cont’d ● Add a factory class (Cont’d) – Define the namespace (Example: ‘AppAction’) – In the invoke() method typehint the $container argument using ContainerInterface. – Gain the $template if the $container has the TemplateRenderInterface. – Gain the DB $adapter also from the $container using AdapterInterface. – Return an instantiation of the Action class created earlier by passing the $template and $adapter. ● Add the factory to the dependencies in the global routes. ● Add a route to access the new middleware ● Create a view template to display the user results.
  • 60. 60 Zend Expressive Workshop ● Let’s Create Moar Middleware!!!
  • 61. 61 Zend Expressive Workshop ● Lab 05 – Create Moar Middleware – Create a uuid middleware to add content into all response headers ● Using Composer add a dependency ‘ramsey/uuid’ ● Add an appropriately named middleware class. (Example: UuidMiddleware) – Define the namespace (Example: ‘AppMiddleware’) – Use PsrHttpMessageResponseInterface, ServerRequestInterface, and RamseyUuidUuid (and maybe RamseyUuidExceptionUnsatisfiedDependencyException). – Return a uuid in the response withHeader. ● Add the new middleware into our middleware services. Remember we want it to ALL responses. ● Verify
  • 62. 62 Zend Expressive Workshop ● Lab 05 – Create Moar Middleware (cont’d) – Continuing… Create middleware to add response time to ALL response headers ● Add an appropriately named middleware class. (Example: RequestTimeMiddleware) – Define the namespace (Example: ‘AppMiddleware’) – Use PsrHttpMessageResponseInterface and ServerRequestInterface. – Create code returning the time the request took – Return the response withHeader. ● Add the new middleware into our middleware services. Remember we want it to ALL responses. ● Verify NOTE: Refer to the expressive-final application if you need hints
  • 63. 63 Zend Expressive Workshop ● Let’s Create a Database Connected Middleware!!! ● With Doctrine!!!
  • 64. 64 Zend Expressive Workshop ● Database Connected Example With Doctrine – First we need a database connection. ● Will use Doctrine DBAL for this example, but could be anything. ● Composer to the rescue!
  • 65. 65 Zend Expressive Workshop ● Database Connected Example With Doctrine – Provide local/instance configuration ● This would be driver and credentials ● (credentials not needed with sqlite) (/config/autoload/dbal.local.php)
  • 66. 66 Zend Expressive Workshop ● Database Connected Example With Doctrine – Create the action (view 1 of 2 - constructor) (/src/App/Action/UserDbalListAction.php)
  • 67. 67 Zend Expressive Workshop ● Database Connected Example With Doctrine – Create the action (view 2 of 2 - __invoke method) (/src/App/Action/UserDbalListAction.php cont’d)
  • 68. 68 Zend Expressive Workshop ● Database Connected Example With Doctrine – Create a factory to pass items needed by the action (/src/App/Action/UserDbalListFactory.php)
  • 69. 69 Zend Expressive Workshop ● Database Connected Example With Doctrine – Add the new action to dependencies, as shown below for the previous action, but with the new namespace for this example (/config/autoload/routes.global.php)
  • 70. 70 Zend Expressive Workshop ● Database Connected Example With Doctrine – Add the new route to dependencies (/config/autoload/routes.global.php)
  • 71. 71 Zend Expressive Workshop ● Database Connected Example With Doctrine – Create the view template (/templates/app/user-dbal-list.phtml)
  • 72. 72 Zend Expressive Workshop ● Database Connected Example With Doctrine – Rejoice!
  • 73. 73 Zend Expressive Workshop ● Lab 06 – Database Connected Middleware – Create a User middleware allowing management of user records in a database using Doctrine Dbal ● Using Composer require dependency ‘doctrinedbal:2.5.*’ ● Create an autoload local config to provide a doctrine-connection container supplying the location to the users.db sqlite database in the /data directory ● Add an appropriately named middleware class (Example: UserDbalListAction) – Define the namespace (Example: ‘AppAction’) – Use PsrHttpMessageResponseInterface, ServerRequestInterface, ZendDiactorosResponseHtmlResponse, and ZendExpressiveTemplate. – Define $template and $connection fields for those objects
  • 74. 74 Zend Expressive Workshop ● Lab 06 – Database Connected Middleware (Cont’d) – Create a User middleware (Cont’d ● Add a middleware class (Cont’d) – Add a constructor to receive/set $template and $connection ● Typehint $template with TemplateTemplateRendererInterface – Add an invoke method leveraging ServerRequestInterface, ResponseInterface, and $next as callable. – Using the Doctrine $connection create the query for Sqlite. – Return the HtmlResponse rendering the view template. ● Add a factory class to prepare the items needed by the Action just created – Use InteropContainerContainerInterface, ZendExpressiveTemplateTemplateRendererInterface, and DoctrineDBALDriverManager.
  • 75. 75 Zend Expressive Workshop ● Lab 06 – Database Connected Middleware (Cont’d) – Create a User middleware (Cont’d ● Add a factory class (Cont’d) – Define the namespace (Example: ‘AppAction’) – In the invoke() method typehint the $container argument using ContainerInterface. – Gain the $template if the $container has the TemplateRenderInterface. – Define the DB $credentials also from the $container and kick off Doctrine to return the $connection to users for the view to use. – Return an instantiation of the Action class created earlier by passing the $template and $connection. ● Add the factory to the dependencies in the global routes. ● Add a route to access the new middleware ● Create a view template to display the user results.
  • 77. 77 Zend Expressive Workshop ● Zend Expressive Skeleton Programmatic – Version 1.1 of Zend Expressive “recommended” approach to adding more middleware will be with a programmatic/explicit approach. ● In Github the repo for expressive-final has an additional branch (name: programmatic) created by Matthew Weier O’Phinney, from the Zend Expressive team, showing the programmatic approach to everything in this workshop. ● https://github.com/adamculp/expressive-workshop
  • 78. 78 Zend Expressive Workshop ● Resources – Zend Expressive Site - http://zendframework.github.io/zend-expressive/ – MasterZendFramework - http://www.masterzendframework.com – Oscar Otero’s list https://github.com/oscarotero/psr7-middlewares – This github repo https://github.com/adamculp/expressive-workshop – Slides - http://www.slideshare.net/adamculp/zend-expressive-workshop – Code used for the workshop - https://github.com/adamculp/expressive- workshop – More to come!
  • 79. 79 Zend Expressive Workshop ● With Zend Expressive: – Easy to build middleware – Lightweight, add what is really needed – Fast – no extra load – Microservices in PHP are better
  • 80. 80 Zend Expressive Workshop ● Give Zend Expressive a Try...Today!!! – https://zendframework.github.io/zend-expressive/
  • 81. ● Thank you! ● Code at: https://github.com/adamculp/expressive-blastoff ● Please rate at: https://joind.in/talk/ec545 Adam Culp http://www.rungeekradio.com http://www.geekyboy.com Twitter @adamculp