SlideShare ist ein Scribd-Unternehmen logo
1 von 35
Downloaden Sie, um offline zu lesen
twitter: @akrabat




Zend Framework 2.0
   Whatʼs new?
         Rob Allen




     ConFoo March 2011
Rob Allen?
•   PHP developer since 1999
•   Wrote Zend_Config
•   Tutorial at akrabat.com
•   Zend Framework in Action!

Next book!
 Zend Framework 2 in Action
 (with Ryan Mauger)
Zend Framework 1.0
How we got here
• Announced October 2005
• Mar 2006: v0.1 released: not a lot!
• July 2007: v1.0: MVC + cool stuff!
• Mar 2008: v1.5: Form, Layout, Context
• Apr 2009: v1.8: Application, Tool, Nav
• Nov 2010: v1.11: SimpleCloud, UserAgent
Where we are today
• Zend Framework 1 core is complete
• New components, adapters and plugins
  are being added

• Widespread usage
• Plenty of help available
Problems with ZF1
• Learning curve
• Performance
• Too much “magic”
• Inconsistency between components
Zend Framework 2.0
 “The primary thrust of ZF 2.0 is to make a more
 consistent, well-documented product, improving
developer productivity and runtime performance.”
                                Matthew Weier OʼPhinney
Think evolution,
 not revolution
Zend Framework 2
   Key goals
Ease learning curve
• Create better documentation
 • Cohesive tutorials
 • Reference manual
• Address API consistency
 • Options
 • Language
Easier extension
• Remove singletons
• Interfaces over abstract classes
• Remove hard-coded dependancies
Improve performance
• Aiming for 200%+ over ZF 1
• Deployment tools
 • Optimise for production
• Documentation
Simplify
• Focus on core components
• Make code readable
• Consistent APIs
Zend Framework 2
  Key changes
“The general theme throughout these
 milestones is narrowing the scope of
 components, and ensuring a proper
   separation of concerns between
            components.”
                   Matthew Weier O’Phinney
PHP 5.3 support
• Advance the use of PHP 5.3
• Namespaces
• Closures over create_function()
Namespaces
// library/Nennius/Controller/Plugin/InitAdminLayout.php
<?php
namespace NenniusControllerPlugin;
use ZendControllerRequestAbstractRequest as Request;
use ZendControllerPluginAbstractPlugin as Plugin;

class InitAdminLayout extends Plugin
{
  public function dispatchLoopStartup(Request $request)
  {
    $fc = ZendControllerFront::getInstance();
    $bootstrap = $fc->getParam('bootstrap');
    $layout = $bootstrap->layout;
    $controllerName = $request->getControllerName();
    if (substr($controllerName, 0, 5) == 'admin') {
        $layout->setLayout('admin');
    }
}
Autoloading
• No more include path
• Standard autoloader
 • Explicit namespace=>path pairs
 • up to 40% performance gain!
• 2: ClassMap autoloader
 • pre-built array map (for deployment)
 • up to 150% performance gain!
Plugin loading
• Alias autoloading
 • map ʻaliasʼ to class that it represents
 • Interface for consistency (clients)
• Plugin broker (central operations)
• Mapping is simpler to explain!
• Much more performant! (up to 5x!)
Plugin loading
$broker = new ZendViewHelperBroker();
$loader = $broker->getPluginLoader();

$loader->register('url', 'MyViewHelperUrl');

// get a ZendViewHelperBaseUrl
$baseUrlHelper = $broker->load('baseUrl');

// get a MyViewHelperUrl
$urlHelper = $broker->load('url');
Exception handling
• Use SPL exceptions for specific catches
• Use an interface for component catches
• Can catch Exception if you donʼt care :)
Exceptions
namespace My;
interface ExceptionInterface {}
class Exception implements ExceptionInterface {}
class InvalidArgument extends InvalidArgumentException
   implements ExceptionInterface {}

try {
    $a = new A();
    $a->b($c);
}
catch (InvalidArgument $e) {
    die("Invalid arg happenedn");
}
catch (ExceptionInterface $e) {
    die("Some error happenedn");
}
MVC
• Will write to the interface!
• Modules as 1st class citizens
• Page controllers
• Service Locator with DI
• Standardise hooks
• View
Internationalisation
• Improve performance
• Use DateTime
• Fix inconsistencies with PHPʼs APIs
• Remove statics and global states
Zend Framework 2
Development process
git
• Smaller barrier to contribution
• Better branching and merging
• ZFʼs git guide: http://bit.ly/zfgit
Unit testing
• Write to /tmp only
• Separate out test asset classes
• Consistent usage of _files directory
• Lower memory/CPU usage
Community Review team
• Smooth the proposal process
• Assist new contributors
• “Fix” orphaned components
• Contact:
 •   IRC: #zftalk.dev on freenode

 •   Email: cr-team@zend.com
Milestones
• Autoloading & plugin loading [done]
• Exceptions [done]
• MVC [in progress]

• Testing
• Documentation [proposals in place]
• Internationalisation
When?
I have no idea!
Summary
• Play with the ZF2 snapshots
• Contribute
    •   Report bugs!

    •   Comment on proposals: http://bit.ly/zf2wiki

• Need help?
    •   IRC: #zftalk on freenode

    •   Mailing list

•   Buy Zend Framework 2 in Action
    (when released!)
Questions?
      feedback: http://joind.in/2854
          email: rob@akrabat.com
                  twitter: @akrabat
Thank you
      feedback: http://joind.in/2854
          email: rob@akrabat.com
                  twitter: @akrabat

Weitere ähnliche Inhalte

Was ist angesagt?

PHP on IBM i Tutorial
PHP on IBM i TutorialPHP on IBM i Tutorial
PHP on IBM i TutorialZendCon
 
Foundations of Zend Framework
Foundations of Zend FrameworkFoundations of Zend Framework
Foundations of Zend FrameworkAdam Culp
 
Zend_Tool: Practical use and Extending
Zend_Tool: Practical use and ExtendingZend_Tool: Practical use and Extending
Zend_Tool: Practical use and ExtendingZendCon
 
Organizing Your PHP Projects (2010 ConFoo)
Organizing Your PHP Projects (2010 ConFoo)Organizing Your PHP Projects (2010 ConFoo)
Organizing Your PHP Projects (2010 ConFoo)Paul Jones
 
Create a welcoming development environment on IBM i
Create a welcoming development environment on IBM iCreate a welcoming development environment on IBM i
Create a welcoming development environment on IBM iAlan Seiden
 
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...Jesse Gallagher
 
Engage 2015 - 10 Mistakes You and Every XPages Developer Make. Yes, I said YOU!
Engage 2015 - 10 Mistakes You and Every XPages Developer Make. Yes, I said YOU!Engage 2015 - 10 Mistakes You and Every XPages Developer Make. Yes, I said YOU!
Engage 2015 - 10 Mistakes You and Every XPages Developer Make. Yes, I said YOU!Serdar Basegmez
 
Zend expressive workshop
Zend expressive workshopZend expressive workshop
Zend expressive workshopAdam Culp
 
KYSUC - Keep Your Schema Under Control
KYSUC - Keep Your Schema Under ControlKYSUC - Keep Your Schema Under Control
KYSUC - Keep Your Schema Under ControlCoimbra JUG
 
Introducing ASP.NET Core 2.0
Introducing ASP.NET Core 2.0Introducing ASP.NET Core 2.0
Introducing ASP.NET Core 2.0Steven Smith
 
Why Plone Will Die
Why Plone Will DieWhy Plone Will Die
Why Plone Will DieAndreas Jung
 
Php Dependency Management with Composer ZendCon 2017
Php Dependency Management with Composer ZendCon 2017Php Dependency Management with Composer ZendCon 2017
Php Dependency Management with Composer ZendCon 2017Clark Everetts
 
Using Play Framework 2 in production
Using Play Framework 2 in productionUsing Play Framework 2 in production
Using Play Framework 2 in productionChristian Papauschek
 
Digpen 7: Why choose Laravel?
Digpen 7: Why choose Laravel?Digpen 7: Why choose Laravel?
Digpen 7: Why choose Laravel?John Blackmore
 
Play framework: lessons learned
Play framework: lessons learnedPlay framework: lessons learned
Play framework: lessons learnedPeter Hilton
 
Analysis of-quality-of-pkgs-in-packagist-univ-20171024
Analysis of-quality-of-pkgs-in-packagist-univ-20171024Analysis of-quality-of-pkgs-in-packagist-univ-20171024
Analysis of-quality-of-pkgs-in-packagist-univ-20171024Clark Everetts
 

Was ist angesagt? (19)

PHP on IBM i Tutorial
PHP on IBM i TutorialPHP on IBM i Tutorial
PHP on IBM i Tutorial
 
Foundations of Zend Framework
Foundations of Zend FrameworkFoundations of Zend Framework
Foundations of Zend Framework
 
Zend_Tool: Practical use and Extending
Zend_Tool: Practical use and ExtendingZend_Tool: Practical use and Extending
Zend_Tool: Practical use and Extending
 
Organizing Your PHP Projects (2010 ConFoo)
Organizing Your PHP Projects (2010 ConFoo)Organizing Your PHP Projects (2010 ConFoo)
Organizing Your PHP Projects (2010 ConFoo)
 
Create a welcoming development environment on IBM i
Create a welcoming development environment on IBM iCreate a welcoming development environment on IBM i
Create a welcoming development environment on IBM i
 
Developing better PHP projects
Developing better PHP projectsDeveloping better PHP projects
Developing better PHP projects
 
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
 
Becoming A Php Ninja
Becoming A Php NinjaBecoming A Php Ninja
Becoming A Php Ninja
 
Enterprise PHP
Enterprise PHPEnterprise PHP
Enterprise PHP
 
Engage 2015 - 10 Mistakes You and Every XPages Developer Make. Yes, I said YOU!
Engage 2015 - 10 Mistakes You and Every XPages Developer Make. Yes, I said YOU!Engage 2015 - 10 Mistakes You and Every XPages Developer Make. Yes, I said YOU!
Engage 2015 - 10 Mistakes You and Every XPages Developer Make. Yes, I said YOU!
 
Zend expressive workshop
Zend expressive workshopZend expressive workshop
Zend expressive workshop
 
KYSUC - Keep Your Schema Under Control
KYSUC - Keep Your Schema Under ControlKYSUC - Keep Your Schema Under Control
KYSUC - Keep Your Schema Under Control
 
Introducing ASP.NET Core 2.0
Introducing ASP.NET Core 2.0Introducing ASP.NET Core 2.0
Introducing ASP.NET Core 2.0
 
Why Plone Will Die
Why Plone Will DieWhy Plone Will Die
Why Plone Will Die
 
Php Dependency Management with Composer ZendCon 2017
Php Dependency Management with Composer ZendCon 2017Php Dependency Management with Composer ZendCon 2017
Php Dependency Management with Composer ZendCon 2017
 
Using Play Framework 2 in production
Using Play Framework 2 in productionUsing Play Framework 2 in production
Using Play Framework 2 in production
 
Digpen 7: Why choose Laravel?
Digpen 7: Why choose Laravel?Digpen 7: Why choose Laravel?
Digpen 7: Why choose Laravel?
 
Play framework: lessons learned
Play framework: lessons learnedPlay framework: lessons learned
Play framework: lessons learned
 
Analysis of-quality-of-pkgs-in-packagist-univ-20171024
Analysis of-quality-of-pkgs-in-packagist-univ-20171024Analysis of-quality-of-pkgs-in-packagist-univ-20171024
Analysis of-quality-of-pkgs-in-packagist-univ-20171024
 

Andere mochten auch

Connecting web Applications with Desktop, confoo 2011
Connecting web Applications with Desktop, confoo 2011Connecting web Applications with Desktop, confoo 2011
Connecting web Applications with Desktop, confoo 2011Bachkoutou Toutou
 
Sean coates fifty things and tricks, confoo 2011
Sean coates fifty things and tricks, confoo 2011Sean coates fifty things and tricks, confoo 2011
Sean coates fifty things and tricks, confoo 2011Bachkoutou Toutou
 
Stress Free Deployment - Confoo 2011
Stress Free Deployment  - Confoo 2011Stress Free Deployment  - Confoo 2011
Stress Free Deployment - Confoo 2011Bachkoutou Toutou
 
Kill bottlenecks with gearman, sphinx, and memcached, Confoo 2011
Kill bottlenecks with gearman, sphinx, and memcached, Confoo 2011Kill bottlenecks with gearman, sphinx, and memcached, Confoo 2011
Kill bottlenecks with gearman, sphinx, and memcached, Confoo 2011Bachkoutou Toutou
 
Building APIs with Apigilty and Zend Framework 2
Building APIs with Apigilty and Zend Framework 2Building APIs with Apigilty and Zend Framework 2
Building APIs with Apigilty and Zend Framework 2David Stockton
 
Making php see, confoo 2011
Making php see, confoo 2011 Making php see, confoo 2011
Making php see, confoo 2011 Bachkoutou Toutou
 

Andere mochten auch (7)

Connecting web Applications with Desktop, confoo 2011
Connecting web Applications with Desktop, confoo 2011Connecting web Applications with Desktop, confoo 2011
Connecting web Applications with Desktop, confoo 2011
 
Sean coates fifty things and tricks, confoo 2011
Sean coates fifty things and tricks, confoo 2011Sean coates fifty things and tricks, confoo 2011
Sean coates fifty things and tricks, confoo 2011
 
Stress Free Deployment - Confoo 2011
Stress Free Deployment  - Confoo 2011Stress Free Deployment  - Confoo 2011
Stress Free Deployment - Confoo 2011
 
Kill bottlenecks with gearman, sphinx, and memcached, Confoo 2011
Kill bottlenecks with gearman, sphinx, and memcached, Confoo 2011Kill bottlenecks with gearman, sphinx, and memcached, Confoo 2011
Kill bottlenecks with gearman, sphinx, and memcached, Confoo 2011
 
Building APIs with Apigilty and Zend Framework 2
Building APIs with Apigilty and Zend Framework 2Building APIs with Apigilty and Zend Framework 2
Building APIs with Apigilty and Zend Framework 2
 
Making php see, confoo 2011
Making php see, confoo 2011 Making php see, confoo 2011
Making php see, confoo 2011
 
Technological and Mobility Trends in e-Government
Technological and Mobility Trends in e-GovernmentTechnological and Mobility Trends in e-Government
Technological and Mobility Trends in e-Government
 

Ähnlich wie Zend Framework 2, What's new, Confoo 2011

They why behind php frameworks
They why behind php frameworksThey why behind php frameworks
They why behind php frameworksKirk Madera
 
Extending ZF & Extending With ZF
Extending ZF & Extending With ZFExtending ZF & Extending With ZF
Extending ZF & Extending With ZFRalph Schindler
 
ZF2: Writing Service Components
ZF2: Writing Service ComponentsZF2: Writing Service Components
ZF2: Writing Service ComponentsMike Willbanks
 
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
 
Best Practices for Building WordPress Applications
Best Practices for Building WordPress ApplicationsBest Practices for Building WordPress Applications
Best Practices for Building WordPress ApplicationsTaylor Lovett
 
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013Mack Hardy
 
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20Michael Lihs
 
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...E. Camden Fisher
 
Add-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his DutyAdd-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his Dutyreedmaniac
 
Angular 2 overview
Angular 2 overviewAngular 2 overview
Angular 2 overviewJesse Warden
 
CakePHP 2.0 - PHP Matsuri 2011
CakePHP 2.0 - PHP Matsuri 2011CakePHP 2.0 - PHP Matsuri 2011
CakePHP 2.0 - PHP Matsuri 2011Graham Weldon
 
Automating Web Application Deployment
Automating Web Application DeploymentAutomating Web Application Deployment
Automating Web Application DeploymentMathew Byrne
 
Penny coventry fiddler-spsbe23
Penny coventry fiddler-spsbe23Penny coventry fiddler-spsbe23
Penny coventry fiddler-spsbe23BIWUG
 
Add-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his DutyAdd-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his DutyLeslie Doherty
 
August Webinar - Water Cooler Talks: A Look into a Developer's Workbench
August Webinar - Water Cooler Talks: A Look into a Developer's WorkbenchAugust Webinar - Water Cooler Talks: A Look into a Developer's Workbench
August Webinar - Water Cooler Talks: A Look into a Developer's WorkbenchHoward Greenberg
 

Ähnlich wie Zend Framework 2, What's new, Confoo 2011 (20)

They why behind php frameworks
They why behind php frameworksThey why behind php frameworks
They why behind php frameworks
 
Extending ZF & Extending With ZF
Extending ZF & Extending With ZFExtending ZF & Extending With ZF
Extending ZF & Extending With ZF
 
ZF2: Writing Service Components
ZF2: Writing Service ComponentsZF2: Writing Service Components
ZF2: Writing Service Components
 
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
 
Best Practices for Building WordPress Applications
Best Practices for Building WordPress ApplicationsBest Practices for Building WordPress Applications
Best Practices for Building WordPress Applications
 
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
 
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
 
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
 
Zend
ZendZend
Zend
 
Add-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his DutyAdd-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his Duty
 
presentation
presentationpresentation
presentation
 
Angular 2 overview
Angular 2 overviewAngular 2 overview
Angular 2 overview
 
CakePHP 2.0 - PHP Matsuri 2011
CakePHP 2.0 - PHP Matsuri 2011CakePHP 2.0 - PHP Matsuri 2011
CakePHP 2.0 - PHP Matsuri 2011
 
Automating Web Application Deployment
Automating Web Application DeploymentAutomating Web Application Deployment
Automating Web Application Deployment
 
Penny coventry fiddler-spsbe23
Penny coventry fiddler-spsbe23Penny coventry fiddler-spsbe23
Penny coventry fiddler-spsbe23
 
Zend Framwork configurations
Zend Framwork configurationsZend Framwork configurations
Zend Framwork configurations
 
presentation
presentationpresentation
presentation
 
Add-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his DutyAdd-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his Duty
 
August Webinar - Water Cooler Talks: A Look into a Developer's Workbench
August Webinar - Water Cooler Talks: A Look into a Developer's WorkbenchAugust Webinar - Water Cooler Talks: A Look into a Developer's Workbench
August Webinar - Water Cooler Talks: A Look into a Developer's Workbench
 
Zend Framwork presentation
Zend Framwork presentationZend Framwork presentation
Zend Framwork presentation
 

Mehr von Bachkoutou Toutou

hacking your website with vega, confoo2011
hacking your website with vega, confoo2011hacking your website with vega, confoo2011
hacking your website with vega, confoo2011Bachkoutou Toutou
 
Premiers pas dans les extensions PHP, Pierrick Charron, Confoo 2011
Premiers pas dans les extensions PHP, Pierrick Charron, Confoo 2011Premiers pas dans les extensions PHP, Pierrick Charron, Confoo 2011
Premiers pas dans les extensions PHP, Pierrick Charron, Confoo 2011Bachkoutou Toutou
 
Connecting Web Application and Desktop, confoo 2011, qafoo
Connecting Web Application and Desktop, confoo 2011, qafooConnecting Web Application and Desktop, confoo 2011, qafoo
Connecting Web Application and Desktop, confoo 2011, qafooBachkoutou Toutou
 
99 problems but the search aint one, confoo 2011, andrei zmievski
99 problems but the search aint one, confoo 2011, andrei zmievski99 problems but the search aint one, confoo 2011, andrei zmievski
99 problems but the search aint one, confoo 2011, andrei zmievskiBachkoutou Toutou
 
Php Inside - confoo 2011 - Derick Rethans
Php Inside -  confoo 2011 - Derick RethansPhp Inside -  confoo 2011 - Derick Rethans
Php Inside - confoo 2011 - Derick RethansBachkoutou Toutou
 
WebShell - confoo 2011 - sean coates
WebShell - confoo 2011 - sean coatesWebShell - confoo 2011 - sean coates
WebShell - confoo 2011 - sean coatesBachkoutou Toutou
 
Confoo 2011 - Advanced OO Patterns
Confoo 2011 - Advanced OO PatternsConfoo 2011 - Advanced OO Patterns
Confoo 2011 - Advanced OO PatternsBachkoutou Toutou
 

Mehr von Bachkoutou Toutou (9)

hacking your website with vega, confoo2011
hacking your website with vega, confoo2011hacking your website with vega, confoo2011
hacking your website with vega, confoo2011
 
Premiers pas dans les extensions PHP, Pierrick Charron, Confoo 2011
Premiers pas dans les extensions PHP, Pierrick Charron, Confoo 2011Premiers pas dans les extensions PHP, Pierrick Charron, Confoo 2011
Premiers pas dans les extensions PHP, Pierrick Charron, Confoo 2011
 
Connecting Web Application and Desktop, confoo 2011, qafoo
Connecting Web Application and Desktop, confoo 2011, qafooConnecting Web Application and Desktop, confoo 2011, qafoo
Connecting Web Application and Desktop, confoo 2011, qafoo
 
99 problems but the search aint one, confoo 2011, andrei zmievski
99 problems but the search aint one, confoo 2011, andrei zmievski99 problems but the search aint one, confoo 2011, andrei zmievski
99 problems but the search aint one, confoo 2011, andrei zmievski
 
Php Inside - confoo 2011 - Derick Rethans
Php Inside -  confoo 2011 - Derick RethansPhp Inside -  confoo 2011 - Derick Rethans
Php Inside - confoo 2011 - Derick Rethans
 
WebShell - confoo 2011 - sean coates
WebShell - confoo 2011 - sean coatesWebShell - confoo 2011 - sean coates
WebShell - confoo 2011 - sean coates
 
Apc Memcached Confoo 2011
Apc Memcached Confoo 2011Apc Memcached Confoo 2011
Apc Memcached Confoo 2011
 
Xdebug confoo11
Xdebug confoo11Xdebug confoo11
Xdebug confoo11
 
Confoo 2011 - Advanced OO Patterns
Confoo 2011 - Advanced OO PatternsConfoo 2011 - Advanced OO Patterns
Confoo 2011 - Advanced OO Patterns
 

Zend Framework 2, What's new, Confoo 2011

  • 1. twitter: @akrabat Zend Framework 2.0 Whatʼs new? Rob Allen ConFoo March 2011
  • 2. Rob Allen? • PHP developer since 1999 • Wrote Zend_Config • Tutorial at akrabat.com • Zend Framework in Action! Next book! Zend Framework 2 in Action (with Ryan Mauger)
  • 4. How we got here • Announced October 2005 • Mar 2006: v0.1 released: not a lot! • July 2007: v1.0: MVC + cool stuff! • Mar 2008: v1.5: Form, Layout, Context • Apr 2009: v1.8: Application, Tool, Nav • Nov 2010: v1.11: SimpleCloud, UserAgent
  • 5. Where we are today • Zend Framework 1 core is complete • New components, adapters and plugins are being added • Widespread usage • Plenty of help available
  • 6. Problems with ZF1 • Learning curve • Performance • Too much “magic” • Inconsistency between components
  • 7. Zend Framework 2.0 “The primary thrust of ZF 2.0 is to make a more consistent, well-documented product, improving developer productivity and runtime performance.” Matthew Weier OʼPhinney
  • 8. Think evolution, not revolution
  • 9. Zend Framework 2 Key goals
  • 10. Ease learning curve • Create better documentation • Cohesive tutorials • Reference manual • Address API consistency • Options • Language
  • 11. Easier extension • Remove singletons • Interfaces over abstract classes • Remove hard-coded dependancies
  • 12. Improve performance • Aiming for 200%+ over ZF 1 • Deployment tools • Optimise for production • Documentation
  • 13. Simplify • Focus on core components • Make code readable • Consistent APIs
  • 14. Zend Framework 2 Key changes
  • 15. “The general theme throughout these milestones is narrowing the scope of components, and ensuring a proper separation of concerns between components.” Matthew Weier O’Phinney
  • 16. PHP 5.3 support • Advance the use of PHP 5.3 • Namespaces • Closures over create_function()
  • 17. Namespaces // library/Nennius/Controller/Plugin/InitAdminLayout.php <?php namespace NenniusControllerPlugin; use ZendControllerRequestAbstractRequest as Request; use ZendControllerPluginAbstractPlugin as Plugin; class InitAdminLayout extends Plugin { public function dispatchLoopStartup(Request $request) { $fc = ZendControllerFront::getInstance(); $bootstrap = $fc->getParam('bootstrap'); $layout = $bootstrap->layout; $controllerName = $request->getControllerName(); if (substr($controllerName, 0, 5) == 'admin') { $layout->setLayout('admin'); } }
  • 18. Autoloading • No more include path • Standard autoloader • Explicit namespace=>path pairs • up to 40% performance gain! • 2: ClassMap autoloader • pre-built array map (for deployment) • up to 150% performance gain!
  • 19. Plugin loading • Alias autoloading • map ʻaliasʼ to class that it represents • Interface for consistency (clients) • Plugin broker (central operations) • Mapping is simpler to explain! • Much more performant! (up to 5x!)
  • 20. Plugin loading $broker = new ZendViewHelperBroker(); $loader = $broker->getPluginLoader(); $loader->register('url', 'MyViewHelperUrl'); // get a ZendViewHelperBaseUrl $baseUrlHelper = $broker->load('baseUrl'); // get a MyViewHelperUrl $urlHelper = $broker->load('url');
  • 21. Exception handling • Use SPL exceptions for specific catches • Use an interface for component catches • Can catch Exception if you donʼt care :)
  • 22. Exceptions namespace My; interface ExceptionInterface {} class Exception implements ExceptionInterface {} class InvalidArgument extends InvalidArgumentException implements ExceptionInterface {} try { $a = new A(); $a->b($c); } catch (InvalidArgument $e) { die("Invalid arg happenedn"); } catch (ExceptionInterface $e) { die("Some error happenedn"); }
  • 23. MVC • Will write to the interface! • Modules as 1st class citizens • Page controllers • Service Locator with DI • Standardise hooks • View
  • 24. Internationalisation • Improve performance • Use DateTime • Fix inconsistencies with PHPʼs APIs • Remove statics and global states
  • 26. git • Smaller barrier to contribution • Better branching and merging • ZFʼs git guide: http://bit.ly/zfgit
  • 27. Unit testing • Write to /tmp only • Separate out test asset classes • Consistent usage of _files directory • Lower memory/CPU usage
  • 28. Community Review team • Smooth the proposal process • Assist new contributors • “Fix” orphaned components • Contact: • IRC: #zftalk.dev on freenode • Email: cr-team@zend.com
  • 29. Milestones • Autoloading & plugin loading [done] • Exceptions [done] • MVC [in progress] • Testing • Documentation [proposals in place] • Internationalisation
  • 30. When?
  • 31. I have no idea!
  • 33. • Play with the ZF2 snapshots • Contribute • Report bugs! • Comment on proposals: http://bit.ly/zf2wiki • Need help? • IRC: #zftalk on freenode • Mailing list • Buy Zend Framework 2 in Action (when released!)
  • 34. Questions? feedback: http://joind.in/2854 email: rob@akrabat.com twitter: @akrabat
  • 35. Thank you feedback: http://joind.in/2854 email: rob@akrabat.com twitter: @akrabat