SlideShare a Scribd company logo
Foundations of Zend Framework
By:
Adam Culp
Twitter: @adamculp
Foundations of Zend Framework
 About me
 PHP 5.3 Certified
 Consultant at Zend Technologies
 Organizer SoFloPHP (South Florida)
 Organizer SunshinePHP (Miami)
 Long Distance (ultra) Runner
 Judo Black Belt Instructor
Foundations of Zend Framework
 What is...
 90,529,980 installs
(Packagist Dec 5th
, 2016)
 Uses PHP >= 5.6 or 7.0
 Open Source
 On GitHub
 Composer Installation
 Built on MVC design pattern
 Can be used as components or entire framework
(61 packages)
Foundations of Zend Framework
 Skeleton Application
 Git clone Zendframework Skeleton Application
 Github /zendframework/ZendSkeletonApplication
Foundations of Zend Framework
 Composer
 Install Zend Framework
 Collection of 61 packages
 Composer install
 Creates and/or populates '/vendor' directory
 Sets up Composer autoloader (PSR-4)
 composer create-project zendframework/skeleton-
application
 composer require zendframework/zendframework
Foundations of Zend Framework
 Structure
Foundations of Zend Framework
 Zend Framework Usage
 NO MAGIC!!!
 Configuration driven
 No forced structure
 Uses namespaces
Foundations of Zend Framework
 MVC
 Very briefly
Foundations of Zend Framework
 Typical Application Flow - Load
 index.php
 Loads autoloader (PSR-4 = default)
 init Application using application.config.php
Foundations of Zend Framework
 Typical Application Flow – App Config
 application.config.php
 Loads modules one at a time
 (Module.php = convention)
 Specifies where to find modules
 Loads configs in autoload directory (DB settings,
etc.)
Foundations of Zend Framework
 Typical Application Flow – Modules
 Module.php (convention)
 Makes MvcEvent accessible via onBootstrap()
 Giving further access to Application, Event Manager,
and Service Manager.
 Loads module.config.php
 Specifies autoloader and location of files.
 May define services and wire event listeners as
needed.
Foundations of Zend Framework
 Typical Application Flow – Module Config
 module.config.php
 Containers are component specific
 Routes
 Navigation
 Service Manager
 Translator
 Controllers
 View Manager
 Steer clear of Closures (Anonymous Functions)
 Do not cache well within array.
 Less performant (parsed and compiled on every req)
as a factory only parsed when service is used.
Foundations of Zend Framework
 Routes
Foundations of Zend Framework
 Routes
 Carries how controller maps to request
 Types:
 Hostname – 'me.adamculp.com'
 Literal - '/home'
 Method – 'post,put'
 Part – creates a tree of possible routes
 Regex – use regex to match url '/blog/?<id>[0-9]?'
 Scheme – 'https'
 Segment - '/:controller[/:action][/]'
 Query – specify and capture query string params
Foundations of Zend Framework
 Route Example
/module/Application/config/module.config.php
Foundations of Zend Framework
 Event Manager
Foundations of Zend Framework
 Event Manager
 Many Event Managers
 Each is isolated
 Events are actions
 Many custom we create
 Defaults (following slide)
Foundations of Zend Framework
 Diagram of MVC Events
Foundations of Zend Framework
 Event Manager Example
/module/Application/Module.php
Foundations of Zend Framework
 Shared Event Manager
 There is only one!
 Similar to Event Manager
 Obtain from Event Manager
 Allows other lower level
Event Managers to
communicate with each
other.
 Globally available
 Why?
 May want to attach to objects not yet created, such
as attaching to all controllers.
Foundations of Zend Framework
 Shared Event Manager Example
/module/Application/Module.php
Foundations of Zend Framework
 Event Manager Characteristics
 An Object
 Attach Triggers to Events
 Listeners are callbacks when Trigger satisfied
 Function or Anon Function (action)
 Queues by priority (last parameter in call)
 Patterns
 Pub/Sub
 Class that triggers the event is publisher
 Listener is subscribing to the event
 Observer - (Subject/Observer)
 Listener is the observer
 Class Triggering the event is the subject
Foundations of Zend Framework
 Services
 ALL THE THINGS!
Foundations of Zend Framework
 Service Manager
 Recommended alternative to ZendDi
 Di pure DIC, SM is factory-based container
 Everything is a service, even Controllers
 Can be created from:
 Application configuration
 Module classes
 Useful if anon functions desired
 Module configuration (most common)
 No anon functions due to caching issues
 Local override configuration
 For times when vendor keys need over-written
 Specified in application config
Foundations of Zend Framework
 Defining Services
 Beware key name overwritting
 Use fully qualified class name when applicable
 MyAppControllerProductIndex
 Or be descriptive
 {module}-{name}
 'product-category' instead of 'category'
 All keys get normalized
 AppControllerProductIndex == app-controller-
product-index
 Hierarchy of definitions
 Module.php – initial
 module.config.php over-rides Module.php
 Local over-rides module.config.php
Foundations of Zend Framework
 Service Types
 Types:
 Services – Explicit
 key => value pairs (string, boolean, float, object)
 Invokables
 key => class (class/object with no needed
dependencies)
 Factories
 key => object (class/object with needed dependencies)
 Aliases (name => some other name)
 Abstract Factories (unknown services)
 Scoped Containers (limit what can be created)
 Shared (or not; you decide)
Foundations of Zend Framework
 Service Config Example
/module/Application/config/module.config.php
Foundations of Zend Framework
 Service Module Example
/module/Application/config/module.php
Foundations of Zend Framework
 Using Service Example
/module/Application/Module.php
/module/Application/view/layout/layout.phtml
Foundations of Zend Framework
 Using Service In Factory Example
/module/Application/Factory/CategoryControllerFactory.php
Foundations of Zend Framework
 Module Manager
Foundations of Zend Framework
 Module Manager
 Gets directives from application.config.php
 Modules to load
 Order is important if module depends on another
 Where to find modules (convention found in)
 Modules directory
 Vendor directory
 Loads each module
 Module.php
 For dynamic content/settings
 module.config.php (if getConfig() in Module.php)
 Over-rides Module.php
 Then hand off to MvcEvent process to Bootstrap.
Foundations of Zend Framework
 Module Basics
 Relative to a specific “problem”.
 Logical separation of application functionality
 Reusable
 Removing a module doesn't kill the application
 Contains everything specific to given module
 Keep init() and onBootstrap() in modules light.
 Do not add data to module structure.
Foundations of Zend Framework
 Module Contents
 Contents
 PHP Code
 MVC Functionality
 Library Code
 Though better in Application or via Composer
 May not be related to MVC
 View scripts
 Public assets (images, css, javascript)
 More?
Foundations of Zend Framework
 Module Skeleton
 Easy creation using Zend Skeleton Module
 GitHub /zendframework/ZendSkeletonModule
Foundations of Zend Framework
 Other Things Worth Investigating
 Views
 Forms
 Databases
 Navigation
 View Strategies (Action or Restful)
Sorry, just not enough time in a regular talk.
Foundations of Zend Framework
 Resources
 http://framework.zend.com
 http://www.zend.com/en/services/training/course-catal
og/zend-framework-2
 http://www.zend.com/en/services/training/course-cata
log/zend-framework-2-advanced
 http://zendframework2.de/cheat-sheet.html
 https://docs.zendframework.com/tutorials/migration/to-v
3/overview/
 https://olegkrivtsov.github.io/using-zend-framework-3-bo
ok/html/index.html
Foundations of Zend Framework
 Thank You!
 Code: https://github.com/adamculp/foundations-zf2-talk
Adam Culp
http://www.geekyboy.com
http://RunGeekRadio.com
Twitter @adamculp

More Related Content

What's hot

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
Adam Englander
 
cf.Objective() 2017 - Design patterns - Brad Wood
cf.Objective() 2017 - Design patterns - Brad Woodcf.Objective() 2017 - Design patterns - Brad Wood
cf.Objective() 2017 - Design patterns - Brad Wood
Ortus Solutions, Corp
 
AN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLE
AN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLEAN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLE
AN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLE
Gavin Pickin
 
Perl6 DBDI YAPC::EU 201008
Perl6 DBDI YAPC::EU 201008Perl6 DBDI YAPC::EU 201008
Perl6 DBDI YAPC::EU 201008
Tim Bunce
 
Zend con what-i-learned-about-mobile-first
Zend con what-i-learned-about-mobile-firstZend con what-i-learned-about-mobile-first
Zend con what-i-learned-about-mobile-first
Clark Everetts
 
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
Ortus Solutions, Corp
 
Yet Another Continuous Integration Story
Yet Another Continuous Integration StoryYet Another Continuous Integration Story
Yet Another Continuous Integration Story
Anton Serdyuk
 
Zend Framework 2 - PHPUnit
Zend Framework 2 - PHPUnitZend Framework 2 - PHPUnit
Zend Framework 2 - PHPUnit
Tarun Kumar Singhal
 
Practical PHP Deployment with Jenkins
Practical PHP Deployment with JenkinsPractical PHP Deployment with Jenkins
Practical PHP Deployment with Jenkins
Adam Culp
 
Automate Thyself
Automate ThyselfAutomate Thyself
Automate Thyself
Ortus Solutions, Corp
 
Gradle起步走: 以CLI Application為例 @ JCConf 2014
Gradle起步走: 以CLI Application為例 @ JCConf 2014Gradle起步走: 以CLI Application為例 @ JCConf 2014
Gradle起步走: 以CLI Application為例 @ JCConf 2014
Chen-en Lu
 
"How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie...
"How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie..."How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie...
"How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie...
Fwdays
 
Bootify your spring application
Bootify your spring applicationBootify your spring application
Bootify your spring application
Jimmy Lu
 
Virtual Bolt Workshop, 5 May 2020
Virtual Bolt Workshop, 5 May 2020Virtual Bolt Workshop, 5 May 2020
Virtual Bolt Workshop, 5 May 2020
Puppet
 
Build & deploy PHP application (intro level)
Build & deploy PHP application (intro level)Build & deploy PHP application (intro level)
Build & deploy PHP application (intro level)
Anton Babenko
 
Behat Workshop at WeLovePHP
Behat Workshop at WeLovePHPBehat Workshop at WeLovePHP
Behat Workshop at WeLovePHP
Marcos Quesada
 
Apigility – Lightning Fast API Development - OSSCamp 2014
Apigility – Lightning Fast API Development - OSSCamp 2014 Apigility – Lightning Fast API Development - OSSCamp 2014
Apigility – Lightning Fast API Development - OSSCamp 2014
OSSCube
 
Robotframework
RobotframeworkRobotframework
Robotframework
Ella Sun
 
3 WAYS TO TEST YOUR COLDFUSION API
3 WAYS TO TEST YOUR COLDFUSION API3 WAYS TO TEST YOUR COLDFUSION API
3 WAYS TO TEST YOUR COLDFUSION API
Gavin Pickin
 
How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016
How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016
How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016
Gavin Pickin
 

What's hot (20)

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
 
cf.Objective() 2017 - Design patterns - Brad Wood
cf.Objective() 2017 - Design patterns - Brad Woodcf.Objective() 2017 - Design patterns - Brad Wood
cf.Objective() 2017 - Design patterns - Brad Wood
 
AN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLE
AN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLEAN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLE
AN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLE
 
Perl6 DBDI YAPC::EU 201008
Perl6 DBDI YAPC::EU 201008Perl6 DBDI YAPC::EU 201008
Perl6 DBDI YAPC::EU 201008
 
Zend con what-i-learned-about-mobile-first
Zend con what-i-learned-about-mobile-firstZend con what-i-learned-about-mobile-first
Zend con what-i-learned-about-mobile-first
 
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
 
Yet Another Continuous Integration Story
Yet Another Continuous Integration StoryYet Another Continuous Integration Story
Yet Another Continuous Integration Story
 
Zend Framework 2 - PHPUnit
Zend Framework 2 - PHPUnitZend Framework 2 - PHPUnit
Zend Framework 2 - PHPUnit
 
Practical PHP Deployment with Jenkins
Practical PHP Deployment with JenkinsPractical PHP Deployment with Jenkins
Practical PHP Deployment with Jenkins
 
Automate Thyself
Automate ThyselfAutomate Thyself
Automate Thyself
 
Gradle起步走: 以CLI Application為例 @ JCConf 2014
Gradle起步走: 以CLI Application為例 @ JCConf 2014Gradle起步走: 以CLI Application為例 @ JCConf 2014
Gradle起步走: 以CLI Application為例 @ JCConf 2014
 
"How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie...
"How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie..."How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie...
"How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie...
 
Bootify your spring application
Bootify your spring applicationBootify your spring application
Bootify your spring application
 
Virtual Bolt Workshop, 5 May 2020
Virtual Bolt Workshop, 5 May 2020Virtual Bolt Workshop, 5 May 2020
Virtual Bolt Workshop, 5 May 2020
 
Build & deploy PHP application (intro level)
Build & deploy PHP application (intro level)Build & deploy PHP application (intro level)
Build & deploy PHP application (intro level)
 
Behat Workshop at WeLovePHP
Behat Workshop at WeLovePHPBehat Workshop at WeLovePHP
Behat Workshop at WeLovePHP
 
Apigility – Lightning Fast API Development - OSSCamp 2014
Apigility – Lightning Fast API Development - OSSCamp 2014 Apigility – Lightning Fast API Development - OSSCamp 2014
Apigility – Lightning Fast API Development - OSSCamp 2014
 
Robotframework
RobotframeworkRobotframework
Robotframework
 
3 WAYS TO TEST YOUR COLDFUSION API
3 WAYS TO TEST YOUR COLDFUSION API3 WAYS TO TEST YOUR COLDFUSION API
3 WAYS TO TEST YOUR COLDFUSION API
 
How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016
How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016
How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016
 

Viewers also liked

Deprecated: Foundations of Zend Framework 2
Deprecated: Foundations of Zend Framework 2Deprecated: Foundations of Zend Framework 2
Deprecated: Foundations of Zend Framework 2
Adam Culp
 
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 products
Adam Culp
 
Accidental professional
Accidental professionalAccidental professional
Accidental professional
Adam Culp
 
Refactoring Legacy Code
Refactoring Legacy CodeRefactoring Legacy Code
Refactoring Legacy Code
Adam Culp
 
Refactoring 101
Refactoring 101Refactoring 101
Refactoring 101
Adam Culp
 

Viewers also liked (6)

Deprecated: Foundations of Zend Framework 2
Deprecated: Foundations of Zend Framework 2Deprecated: Foundations of Zend Framework 2
Deprecated: Foundations of Zend Framework 2
 
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
 
Accidental professional
Accidental professionalAccidental professional
Accidental professional
 
Refactoring Legacy Code
Refactoring Legacy CodeRefactoring Legacy Code
Refactoring Legacy Code
 
Refactoring 101
Refactoring 101Refactoring 101
Refactoring 101
 

Similar to Foundations of Zend Framework

Introduction to Zend Framework 2
Introduction to Zend Framework 2Introduction to Zend Framework 2
Introduction to Zend Framework 2
John Coggeshall
 
Zend framework 01 - introduction
Zend framework 01 - introductionZend framework 01 - introduction
Zend framework 01 - introduction
Tricode (part of Dept)
 
2007 Zend Con Mvc
2007 Zend Con Mvc2007 Zend Con Mvc
2007 Zend Con Mvc
Pablo Morales
 
Zf2 phpquebec
Zf2 phpquebecZf2 phpquebec
Zf2 phpquebec
mkherlakian
 
Zend Framework Quick Start Walkthrough
Zend Framework Quick Start WalkthroughZend Framework Quick Start Walkthrough
Zend Framework Quick Start Walkthrough
Bradley Holt
 
ZF2 Modules: Events, Services, and of course, modularity
ZF2 Modules: Events, Services, and of course, modularityZF2 Modules: Events, Services, and of course, modularity
ZF2 Modules: Events, Services, and of course, modularity
John Coggeshall
 
TomatoCMS in A Nutshell
TomatoCMS in A NutshellTomatoCMS in A Nutshell
TomatoCMS in A Nutshell
Siwawong Wuttipongprasert
 
SeedStack feature tour
SeedStack feature tourSeedStack feature tour
SeedStack feature tour
SeedStack
 
Getting Started with Zend Framework
Getting Started with Zend FrameworkGetting Started with Zend Framework
Getting Started with Zend Framework
Juan Antonio
 
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
Jeremy Brown
 
Zf2
Zf2Zf2
Demo
DemoDemo
Demo
bkslide
 
first pitch
first pitchfirst pitch
first pitch
alind tiwari
 
werwr
werwrwerwr
sdfsdf
sdfsdfsdfsdf
sdfsdf
alind tiwari
 
college
collegecollege
college
alind tiwari
 
first pitch
first pitchfirst pitch
first pitch
alind tiwari
 
Greenathan
GreenathanGreenathan
Greenathan
alind tiwari
 
Unit Test for ZF SlideShare Component
Unit Test for ZF SlideShare ComponentUnit Test for ZF SlideShare Component
Unit Test for ZF SlideShare Component
zftalk
 
first pitch
first pitchfirst pitch
first pitch
alind tiwari
 

Similar to Foundations of Zend Framework (20)

Introduction to Zend Framework 2
Introduction to Zend Framework 2Introduction to Zend Framework 2
Introduction to Zend Framework 2
 
Zend framework 01 - introduction
Zend framework 01 - introductionZend framework 01 - introduction
Zend framework 01 - introduction
 
2007 Zend Con Mvc
2007 Zend Con Mvc2007 Zend Con Mvc
2007 Zend Con Mvc
 
Zf2 phpquebec
Zf2 phpquebecZf2 phpquebec
Zf2 phpquebec
 
Zend Framework Quick Start Walkthrough
Zend Framework Quick Start WalkthroughZend Framework Quick Start Walkthrough
Zend Framework Quick Start Walkthrough
 
ZF2 Modules: Events, Services, and of course, modularity
ZF2 Modules: Events, Services, and of course, modularityZF2 Modules: Events, Services, and of course, modularity
ZF2 Modules: Events, Services, and of course, modularity
 
TomatoCMS in A Nutshell
TomatoCMS in A NutshellTomatoCMS in A Nutshell
TomatoCMS in A Nutshell
 
SeedStack feature tour
SeedStack feature tourSeedStack feature tour
SeedStack feature tour
 
Getting Started with Zend Framework
Getting Started with Zend FrameworkGetting Started with Zend Framework
Getting Started with Zend Framework
 
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
 
Zf2
Zf2Zf2
Zf2
 
Demo
DemoDemo
Demo
 
first pitch
first pitchfirst pitch
first pitch
 
werwr
werwrwerwr
werwr
 
sdfsdf
sdfsdfsdfsdf
sdfsdf
 
college
collegecollege
college
 
first pitch
first pitchfirst pitch
first pitch
 
Greenathan
GreenathanGreenathan
Greenathan
 
Unit Test for ZF SlideShare Component
Unit Test for ZF SlideShare ComponentUnit Test for ZF SlideShare Component
Unit Test for ZF SlideShare Component
 
first pitch
first pitchfirst pitch
first pitch
 

More from Adam Culp

Hypermedia
HypermediaHypermedia
Hypermedia
Adam Culp
 
Putting legacy to REST with middleware
Putting legacy to REST with middlewarePutting legacy to REST with middleware
Putting legacy to REST with middleware
Adam Culp
 
php-1701-a
php-1701-aphp-1701-a
php-1701-a
Adam Culp
 
Release your refactoring superpower
Release your refactoring superpowerRelease your refactoring superpower
Release your refactoring superpower
Adam Culp
 
Managing Technical Debt
Managing Technical DebtManaging Technical Debt
Managing Technical Debt
Adam Culp
 
Developing PHP Applications Faster
Developing PHP Applications FasterDeveloping PHP Applications Faster
Developing PHP Applications Faster
Adam Culp
 
Containing Quality
Containing QualityContaining Quality
Containing Quality
Adam Culp
 
Debugging elephpants
Debugging elephpantsDebugging elephpants
Debugging elephpants
Adam Culp
 
Clean application development tutorial
Clean application development tutorialClean application development tutorial
Clean application development tutorial
Adam Culp
 
Essential git for developers
Essential git for developersEssential git for developers
Essential git for developers
Adam Culp
 
Vagrant for Virtualized Development
Vagrant for Virtualized DevelopmentVagrant for Virtualized Development
Vagrant for Virtualized Development
Adam 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 API
Adam Culp
 
Puppet and Vagrant in development
Puppet and Vagrant in developmentPuppet and Vagrant in development
Puppet and Vagrant in development
Adam Culp
 
Refactoring PHP
Refactoring PHPRefactoring PHP
Refactoring PHP
Adam Culp
 
Selenium testing IDE 101
Selenium testing IDE 101Selenium testing IDE 101
Selenium testing IDE 101
Adam 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.3
Adam Culp
 
Development Environment Tips
Development Environment TipsDevelopment Environment Tips
Development Environment Tips
Adam Culp
 
Getting your project_started
Getting your project_startedGetting your project_started
Getting your project_started
Adam Culp
 
PHP and PDFLib
PHP and PDFLibPHP and PDFLib
PHP and PDFLib
Adam 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
 
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
 
PHP and PDFLib
PHP and PDFLibPHP and PDFLib
PHP and PDFLib
 

Recently uploaded

Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
Dinusha Kumarasiri
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdfNunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
flufftailshop
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Jeffrey Haguewood
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
saastr
 
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStrDeep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
saastr
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
alexjohnson7307
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
Trusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process MiningTrusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process Mining
LucaBarbaro3
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
fredae14
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 

Recently uploaded (20)

Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdfNunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
 
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStrDeep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
Trusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process MiningTrusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process Mining
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 

Foundations of Zend Framework

  • 1. Foundations of Zend Framework By: Adam Culp Twitter: @adamculp
  • 2. Foundations of Zend Framework  About me  PHP 5.3 Certified  Consultant at Zend Technologies  Organizer SoFloPHP (South Florida)  Organizer SunshinePHP (Miami)  Long Distance (ultra) Runner  Judo Black Belt Instructor
  • 3. Foundations of Zend Framework  What is...  90,529,980 installs (Packagist Dec 5th , 2016)  Uses PHP >= 5.6 or 7.0  Open Source  On GitHub  Composer Installation  Built on MVC design pattern  Can be used as components or entire framework (61 packages)
  • 4. Foundations of Zend Framework  Skeleton Application  Git clone Zendframework Skeleton Application  Github /zendframework/ZendSkeletonApplication
  • 5. Foundations of Zend Framework  Composer  Install Zend Framework  Collection of 61 packages  Composer install  Creates and/or populates '/vendor' directory  Sets up Composer autoloader (PSR-4)  composer create-project zendframework/skeleton- application  composer require zendframework/zendframework
  • 6. Foundations of Zend Framework  Structure
  • 7. Foundations of Zend Framework  Zend Framework Usage  NO MAGIC!!!  Configuration driven  No forced structure  Uses namespaces
  • 8. Foundations of Zend Framework  MVC  Very briefly
  • 9. Foundations of Zend Framework  Typical Application Flow - Load  index.php  Loads autoloader (PSR-4 = default)  init Application using application.config.php
  • 10. Foundations of Zend Framework  Typical Application Flow – App Config  application.config.php  Loads modules one at a time  (Module.php = convention)  Specifies where to find modules  Loads configs in autoload directory (DB settings, etc.)
  • 11. Foundations of Zend Framework  Typical Application Flow – Modules  Module.php (convention)  Makes MvcEvent accessible via onBootstrap()  Giving further access to Application, Event Manager, and Service Manager.  Loads module.config.php  Specifies autoloader and location of files.  May define services and wire event listeners as needed.
  • 12. Foundations of Zend Framework  Typical Application Flow – Module Config  module.config.php  Containers are component specific  Routes  Navigation  Service Manager  Translator  Controllers  View Manager  Steer clear of Closures (Anonymous Functions)  Do not cache well within array.  Less performant (parsed and compiled on every req) as a factory only parsed when service is used.
  • 13. Foundations of Zend Framework  Routes
  • 14. Foundations of Zend Framework  Routes  Carries how controller maps to request  Types:  Hostname – 'me.adamculp.com'  Literal - '/home'  Method – 'post,put'  Part – creates a tree of possible routes  Regex – use regex to match url '/blog/?<id>[0-9]?'  Scheme – 'https'  Segment - '/:controller[/:action][/]'  Query – specify and capture query string params
  • 15. Foundations of Zend Framework  Route Example /module/Application/config/module.config.php
  • 16. Foundations of Zend Framework  Event Manager
  • 17. Foundations of Zend Framework  Event Manager  Many Event Managers  Each is isolated  Events are actions  Many custom we create  Defaults (following slide)
  • 18. Foundations of Zend Framework  Diagram of MVC Events
  • 19. Foundations of Zend Framework  Event Manager Example /module/Application/Module.php
  • 20. Foundations of Zend Framework  Shared Event Manager  There is only one!  Similar to Event Manager  Obtain from Event Manager  Allows other lower level Event Managers to communicate with each other.  Globally available  Why?  May want to attach to objects not yet created, such as attaching to all controllers.
  • 21. Foundations of Zend Framework  Shared Event Manager Example /module/Application/Module.php
  • 22. Foundations of Zend Framework  Event Manager Characteristics  An Object  Attach Triggers to Events  Listeners are callbacks when Trigger satisfied  Function or Anon Function (action)  Queues by priority (last parameter in call)  Patterns  Pub/Sub  Class that triggers the event is publisher  Listener is subscribing to the event  Observer - (Subject/Observer)  Listener is the observer  Class Triggering the event is the subject
  • 23. Foundations of Zend Framework  Services  ALL THE THINGS!
  • 24. Foundations of Zend Framework  Service Manager  Recommended alternative to ZendDi  Di pure DIC, SM is factory-based container  Everything is a service, even Controllers  Can be created from:  Application configuration  Module classes  Useful if anon functions desired  Module configuration (most common)  No anon functions due to caching issues  Local override configuration  For times when vendor keys need over-written  Specified in application config
  • 25. Foundations of Zend Framework  Defining Services  Beware key name overwritting  Use fully qualified class name when applicable  MyAppControllerProductIndex  Or be descriptive  {module}-{name}  'product-category' instead of 'category'  All keys get normalized  AppControllerProductIndex == app-controller- product-index  Hierarchy of definitions  Module.php – initial  module.config.php over-rides Module.php  Local over-rides module.config.php
  • 26. Foundations of Zend Framework  Service Types  Types:  Services – Explicit  key => value pairs (string, boolean, float, object)  Invokables  key => class (class/object with no needed dependencies)  Factories  key => object (class/object with needed dependencies)  Aliases (name => some other name)  Abstract Factories (unknown services)  Scoped Containers (limit what can be created)  Shared (or not; you decide)
  • 27. Foundations of Zend Framework  Service Config Example /module/Application/config/module.config.php
  • 28. Foundations of Zend Framework  Service Module Example /module/Application/config/module.php
  • 29. Foundations of Zend Framework  Using Service Example /module/Application/Module.php /module/Application/view/layout/layout.phtml
  • 30. Foundations of Zend Framework  Using Service In Factory Example /module/Application/Factory/CategoryControllerFactory.php
  • 31. Foundations of Zend Framework  Module Manager
  • 32. Foundations of Zend Framework  Module Manager  Gets directives from application.config.php  Modules to load  Order is important if module depends on another  Where to find modules (convention found in)  Modules directory  Vendor directory  Loads each module  Module.php  For dynamic content/settings  module.config.php (if getConfig() in Module.php)  Over-rides Module.php  Then hand off to MvcEvent process to Bootstrap.
  • 33. Foundations of Zend Framework  Module Basics  Relative to a specific “problem”.  Logical separation of application functionality  Reusable  Removing a module doesn't kill the application  Contains everything specific to given module  Keep init() and onBootstrap() in modules light.  Do not add data to module structure.
  • 34. Foundations of Zend Framework  Module Contents  Contents  PHP Code  MVC Functionality  Library Code  Though better in Application or via Composer  May not be related to MVC  View scripts  Public assets (images, css, javascript)  More?
  • 35. Foundations of Zend Framework  Module Skeleton  Easy creation using Zend Skeleton Module  GitHub /zendframework/ZendSkeletonModule
  • 36. Foundations of Zend Framework  Other Things Worth Investigating  Views  Forms  Databases  Navigation  View Strategies (Action or Restful) Sorry, just not enough time in a regular talk.
  • 37. Foundations of Zend Framework  Resources  http://framework.zend.com  http://www.zend.com/en/services/training/course-catal og/zend-framework-2  http://www.zend.com/en/services/training/course-cata log/zend-framework-2-advanced  http://zendframework2.de/cheat-sheet.html  https://docs.zendframework.com/tutorials/migration/to-v 3/overview/  https://olegkrivtsov.github.io/using-zend-framework-3-bo ok/html/index.html
  • 38. Foundations of Zend Framework  Thank You!  Code: https://github.com/adamculp/foundations-zf2-talk Adam Culp http://www.geekyboy.com http://RunGeekRadio.com Twitter @adamculp