SlideShare ist ein Scribd-Unternehmen logo
1 von 52
Downloaden Sie, um offline zu lesen
A quick start on
Zend Framework 2
by Enrico Zimuel (enrico@zend.com)

Senior Software Engineer
Zend Framework Core Team
Zend Technologies Ltd




         19th May 2012 Verona (Italy)
                                        © All rights reserved. Zend Technologies, Inc.
About me

               • Enrico Zimuel (@ezimuel)
               • Software Engineer since 1996
                      – Assembly x86, C/C++, Java, Perl, PHP
               • PHP Engineer at Zend in the Zend
                            Framework Core Team
               • International speaker about PHP and
                            computer security topics
               • Co-author of the italian book
                            “PHP Best practices” (FAG edizioni)
               • Co-founder of the PUG Torino




           © All rights reserved. Zend Technologies, Inc.
ZF2 in a slide

 ●
     New architecture (MVC, Di, Events)
 ●   Requirement: PHP 5.3.3
 ●   No more CLA (Contributor License Agreement)
 ●   Git (GitHub) instead of SVN
 ●
     Better performance (new autoload)
 ●
     Module support
 ●
     Packaging system (pyrus)



                      © All rights reserved. Zend Technologies, Inc.
A new core

●
    The ZF1 way:
       ▶   Singleton, Registry, and Hard-
              Coded Dependencies
●   The ZF2 approach:
       ▶   Aspect Oriented Design and
             Dependency Injection




                       © All rights reserved. Zend Technologies, Inc.
New architectural approach

●   Methodologies used in the development
      – Decoupling (ZendDi)
      – Event driven (ZendEventManager)
      – Standard classes (ZendStdlib)
●   Take advantage of PHP 5.3
       ▶   Namespace
       ▶   Lambda Functions and Closures
       ▶   Better performance


                       © All rights reserved. Zend Technologies, Inc.
Releases

●   ZF2.0.0beta4 next week!
●   Goal:
     ▶   beta5 on June
     ▶   ZF 2.0 RC this summer!!!




                         © All rights reserved. Zend Technologies, Inc.
Autoloading




  © All rights reserved. Zend Technologies, Inc.
Autoloading

●   No more require_once calls!
●
    Multiple approaches:
      – ZF1-style include_path autoloader
      – Per-namespace/prefix autoloading
      – Class-map autoloading




                    © All rights reserved. Zend Technologies, Inc.
ZF1-Style


require_once 'Zend/Loader/StandardAutoloader.php';

$loader = new ZendLoaderStandardAutoloader(array(
    'fallback_autoloader' => true,
));

$loader->register();




                    © All rights reserved. Zend Technologies, Inc.
ZF2 NS/Prefix

require_once 'Zend/Loader/StandardAutoloader.php';

$loader = new ZendLoaderStandardAutoloader();

$loader->registerNamespace(
           'My', __DIR__ . '/../library/My')
      ->registerPrefix(
           'Foo_', __DIR__ . '/../library/Foo');

$loader->register();




                       © All rights reserved. Zend Technologies, Inc.
ZF2 Class-Map

return array(
    'MyFooBar' => __DIR__ . '/Foo/Bar.php',
);
                                                                        .classmap.php


require_once 'Zend/Loader/ClassMapAutoloader.php';

$loader = new ZendLoaderClassMapAutoloader();

$loader->registerAutoloadMap(
    __DIR__ . '/../library/.classmap.php');

$loader->register();



                       © All rights reserved. Zend Technologies, Inc.
Classmap generator

●   How to generate the .classmap.php?
     We provided a command line tool:
     bin/classmap_generator.php
●
    Usage is trivial:

    $ cd your/library
    $ php /path/to/classmap_generator.php -w

●
    Class-Map will be created in .classmap.php




                        © All rights reserved. Zend Technologies, Inc.
Performance improvement

●
    Compared with the ZF1 autoloader
    ▶   Class-Maps
          show a 25-85% improvement
    ▶   Namespaces/prefixes
          shows 10-40% improvement




Note: The new autoloading system of ZF2 has been ported to ZF 1.12


                            © All rights reserved. Zend Technologies, Inc.
Dependency
 Injection



  © All rights reserved. Zend Technologies, Inc.
ZendDi

 ●   Supports the 3 different injection patterns:
        – Constructor
        – Interface
        – Setter
 ●   Implements a Di Container:
        – Manage the dependencies using configuration and
            annotation
        – Provide a compiler to autodiscover classes in a path
             and create the class definitions, for dependencies



                        © All rights reserved. Zend Technologies, Inc.
Example

 class Bar
 { … }

 class Foo
 {
    protected $bar;
    …
    public function setBar(Bar $bar)
    {
       $this->bar = $bar;
    }
    …
 }


                © All rights reserved. Zend Technologies, Inc.
Sample definition


 $definition = array(
     'Foo' => array(
         'setBar' => array(
             'bar' => array(
                 'type'     => 'Bar',
                 'required' => true,
             ),
         ),
     ),
 );




                 © All rights reserved. Zend Technologies, Inc.
Using the Di container

 use ZendDiDi,
     ZendDiConfiguration;

 $di     = new Di;
 $config = new Configuration(array(
     'definition' => array('class' => $definition)
 ));
 $config->configure($di);

 $foo = $di->get('Foo'); // contains Bar!




                   © All rights reserved. Zend Technologies, Inc.
Di by annotation

 use ZendDiDefinitionAnnotation as Di;

 class Foo {
    protected $bar;
    /**
     * @DiInject()
     */
    public function setBar(Bar $bar){
        $this->bar = $bar;
    }
 }

 class Bar { ... }


                     © All rights reserved. Zend Technologies, Inc.
Di by annotation (2)


$compiler = new ZendDiDefinitionCompilerDefinition();
$compiler->addDirectory('File path of Foo and Bar');
$compiler->compile();

$definitions = new ZendDiDefinitionList($compiler);
$di = new ZendDiDi($definitions);

$baz = $di->get('Foo'); // contains Bar!



More use cases of ZendDi:
     https://github.com/ralphschindler/zf2-di-use-cases


                        © All rights reserved. Zend Technologies, Inc.
Event Manager




   © All rights reserved. Zend Technologies, Inc.
Event Manager

●
    An Event Manager is an object that aggregates
    listeners for one or more named events, and
    which triggers events.
●
    A Listener is a callback that can react to an
    event.
●
    An Event is an action.




                      © All rights reserved. Zend Technologies, Inc.
Example

use ZendEventManagerEventManager;

$events = new EventManager();
$events->attach('do', function($e) {
    $event = $e->getName();
    $params = $e->getParams();
    printf(
        'Handled event “%s”, with parameters %s',
        $event,
        json_encode($params)
    );
});
$params = array('foo' => 'bar', 'baz' => 'bat');
$events->trigger('do', null, $params);




                     © All rights reserved. Zend Technologies, Inc.
MVC



© All rights reserved. Zend Technologies, Inc.
Event driven architecture


●   Everything is an event in the MVC architecture of ZF2




                     © All rights reserved. Zend Technologies, Inc.
Module definition



  “A module is a collection of code and other
    files that solves a more specific atomic
   problem of the larger business problem.”
                                                        (from the ZF2 RFC)




                 © All rights reserved. Zend Technologies, Inc.
Module for ZF2

●
    The basic unit in a ZF2 application
    is a Module
●
    Modules are “Plug and play” technology
●
    Modules are simple:
       ▶   A namespace
       ▶   Containing a single classfile: Module.php




                         © All rights reserved. Zend Technologies, Inc.
Quick start
Zend Skeleton Application




       © All rights reserved. Zend Technologies, Inc.
Zend Skeleton Application

●   A simple, skeleton application using the new MVC
    layer and the module system
●
    Github:
    ▶   git clone --recursive
        git://github.com/zendframework/ZendSkeletonApplication.git
●
    This project makes use of Git submodules
●
    Ready for ZF2.0.0beta4




                            © All rights reserved. Zend Technologies, Inc.
Folder's tree

   config
   data
   module
   public
   vendor




                © All rights reserved. Zend Technologies, Inc.
Config folder

  config
         autoload
     application.config.php
  data
  module
  public
  vendor



                    © All rights reserved. Zend Technologies, Inc.
Data folder

  config
  data
         cache
  module
  public
  vendor




                 © All rights reserved. Zend Technologies, Inc.
Module folder
  module
      Application                              Name of the module
               config
                    module.config.php
               src
                      Application
                             Controller
                                  IndexController.php
               view
                      index
                           index.phtml
            Module.php
            autoload_classmap.php
            autoload_functions.php
            autoload_registers.php

                     © All rights reserved. Zend Technologies, Inc.
Public folder

   public
        images
        js
        css
      .htaccess
      index.php




                  © All rights reserved. Zend Technologies, Inc.
Vendor folder

  config
  data
  module
  public
  vendor
         ZendFramework




                  © All rights reserved. Zend Technologies, Inc.
.htaccess

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]




                 © All rights reserved. Zend Technologies, Inc.
index.php
chdir(dirname(__DIR__));
require_once (getenv('ZF2_PATH') ?: 'vendor/ZF/library') .
'/Zend/Loader/AutoloaderFactory.php';

use ZendLoaderAutoloaderFactory,
   ZendServiceManagerServiceManager,
   ZendMvcServiceServiceManagerConfiguration;

AutoloaderFactory::factory();
$config = include 'config/application.config.php';

$serviceManager = new ServiceManager(new ServiceManagerConfiguration(
$config['service_manager']));
$serviceManager->setService('ApplicationConfiguration', $config);
$serviceManager->get('ModuleManager')->loadModules();

$serviceManager->get('Application')->bootstrap()->run()->send();



                           © All rights reserved. Zend Technologies, Inc.
application.config.php
 return array(
    'modules' => array(
       'Application',
    ),
      'module_listener_options' => array(
         'config_cache_enabled' => false,
         'cache_dir' => 'data/cache',
         'module_paths' => array(
            './module',
            './vendor',
           ),
      ),
      'service_manager' => array(
          'use_defaults' => true,
          'factories' => array(),
      ),
 );
                            © All rights reserved. Zend Technologies, Inc.
Module.php
namespace Application;

class Module
{
   public function getAutoloaderConfig()
   {
      return array(
         'ZendLoaderClassMapAutoloader' => array(
            __DIR__ . '/autoload_classmap.php',
         ),
         'ZendLoaderStandardAutoloader' => array(
            'namespaces' => array(
               __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
            ),
         ),
      );
   }

    public function getConfig()
    {
      return include __DIR__ . '/config/module.config.php';
    }
}

                                   © All rights reserved. Zend Technologies, Inc.
autoload_classmap.php

return array(
     'ApplicationControllerIndexController' =>
          __DIR__ . '/src/Application/Controller/IndexController.php',
     'ApplicationModule' =>
          __DIR__ . '/Module.php',
);




                               © All rights reserved. Zend Technologies, Inc.
module.config.php
return array(
   'router' => array(
      'routes' => array(
         'default' => array(
            'type' => 'ZendMvcRouterHttpSegment',
            'options' => array(
                'route' => '/[:controller[/:action]]',
                'constraints' => array(
                   'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
                   'action'     => '[a-zA-Z][a-zA-Z0-9_-]*',
                ),
                'defaults' => array(
                   'controller' => 'IndexController',
                   'action' => 'index',
         ),),),
         'home' => array(
            'type' => 'ZendMvcRouterHttpLiteral',
            'options' => array(
                'route' => '/',
                'defaults' => array(
                   'controller' => 'IndexController',
                   'action' => 'index',
          ),),),),),

                                     © All rights reserved. Zend Technologies, Inc.
module.config.php (2)
     'controller' => array(
        'classes' => array(
            'IndexController' => 'ApplicationControllerIndexController'
        ),
     ),
     'view_manager' => array(
        'display_not_found_reason' => true,
        'display_exceptions'          => true,
        'doctype'                     => 'HTML5',
        'not_found_template'          => 'error/404',
        'exception_template'          => 'error/index',
        'template_map' => array(
            'layout/layout' => __DIR__ . '/../view/layout/layout.phtml',
            'index/index' => __DIR__ . '/../view/index/index.phtml',
            'error/404'     => __DIR__ . '/../view/error/404.phtml',
            'error/index' => __DIR__ . '/../view/error/index.phtml',
        ),
        'template_path_stack' => array(
            'application' => __DIR__ . '/../view',
        ),
     ),
);


                                      © All rights reserved. Zend Technologies, Inc.
IndexController.php

namespace ApplicationController;

use ZendMvcControllerActionController,
    ZendViewModelViewModel;

class IndexController extends ActionController
{
   public function indexAction()
   {
      return new ViewModel();
   }
}




                         © All rights reserved. Zend Technologies, Inc.
Packaging system




    © All rights reserved. Zend Technologies, Inc.
Source package

 ●
     http://packages.zendframework.com/
 ●   Download or use pyrus, a PEAR2 installer
 ●
     Pyrus packages:
      ▶   Pyrus setup
      ▶   wget http://packages.zendframework.com/pyrus.phar
      ▶   pyrus.phar .
      ▶   pyrus.phar . channel­discover packages.zendframework.com

      ▶   Install a Zend_<component>
      ▶   pyrus.phar . install zf2/Zend_<component>




                         © All rights reserved. Zend Technologies, Inc.
From ZF1 to ZF2




    © All rights reserved. Zend Technologies, Inc.
Migrate to ZF2

●   Goal: migrate without rewriting much code!
●   Main steps
      – Namespace: Zend_Foo => ZendFoo
      – Exceptions: an Interface for each components,
          no more Zend_Exception
      – Autoloading: 3 options (one is ZF1)
      – MVC: module, event based, dispatchable
      – DB: new ZendDb
      – Form: new ZendForm

                     © All rights reserved. Zend Technologies, Inc.
ZF1 migration prototype

●
    Source code: http://bit.ly/pvc0X1
●
    Creates a "Zf1Compat" version of the ZF1 dispatcher
    as an event listener.
●
    The bootstrap largely mimics how ZF1's
    Zend_Application bootstrap works.
●   The default route utilizes the new ZF2 MVC routing,
    but mimics what ZF1 provided




                     © All rights reserved. Zend Technologies, Inc.
How to contribute




    © All rights reserved. Zend Technologies, Inc.
We want you!

●
    How to contribute:
    ▶   Write code
    ▶   Documentation
    ▶   Testing
    ▶   Feedbacks/comments




         https://github.com/zendframework/zf2

                         © All rights reserved. Zend Technologies, Inc.
Helping out

●
    http://framework.zend.com/zf2
●
    http://github.com/zendframework
●   https://github.com/zendframework/ZendSkeletonApplication
●   Getting Started with Zend Framework 2
    by Rob Allen, http://www.akrabat.com
●
    Weekly IRC meetings (#zf2-meeting on Freenode)
●
    #zftalk.2 on Freenode IRC




                        © All rights reserved. Zend Technologies, Inc.
Thank you!

 ●
     Vote this talk:
        ▶   https://joind.in/6384
 ●
     Comments and feedbacks:
        ▶   enrico@zend.com




                       © All rights reserved. Zend Technologies, Inc.

Weitere ähnliche Inhalte

Was ist angesagt?

ZF2 Modular Architecture - Taking advantage of it
ZF2 Modular Architecture - Taking advantage of itZF2 Modular Architecture - Taking advantage of it
ZF2 Modular Architecture - Taking advantage of itSteve Maraspin
 
Get Started with Zend Framework 2
Get Started with Zend Framework 2Get Started with Zend Framework 2
Get Started with Zend Framework 2Mindfire Solutions
 
Manage cloud infrastructures using Zend Framework 2 (and ZF1)
Manage cloud infrastructures using Zend Framework 2 (and ZF1)Manage cloud infrastructures using Zend Framework 2 (and ZF1)
Manage cloud infrastructures using Zend Framework 2 (and ZF1)Enrico Zimuel
 
ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)
ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)
ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)ZFConf Conference
 
ZFConf 2012: Dependency Management в PHP и Zend Framework 2 (Кирилл Чебунин)
ZFConf 2012: Dependency Management в PHP и Zend Framework 2 (Кирилл Чебунин)ZFConf 2012: Dependency Management в PHP и Zend Framework 2 (Кирилл Чебунин)
ZFConf 2012: Dependency Management в PHP и Zend Framework 2 (Кирилл Чебунин)ZFConf Conference
 
Zend Framework 2 - presentation
Zend Framework 2 - presentationZend Framework 2 - presentation
Zend Framework 2 - presentationyamcsha
 
Cryptography with Zend Framework
Cryptography with Zend FrameworkCryptography with Zend Framework
Cryptography with Zend FrameworkEnrico Zimuel
 
Instant ACLs with Zend Framework 2
Instant ACLs with Zend Framework 2Instant ACLs with Zend Framework 2
Instant ACLs with Zend Framework 2Stefano Valle
 
ZFConf 2012: Реализация доступа к СУБД IBM DB2 посредством встраиваемого SQL ...
ZFConf 2012: Реализация доступа к СУБД IBM DB2 посредством встраиваемого SQL ...ZFConf 2012: Реализация доступа к СУБД IBM DB2 посредством встраиваемого SQL ...
ZFConf 2012: Реализация доступа к СУБД IBM DB2 посредством встраиваемого SQL ...ZFConf Conference
 
Manage cloud infrastructures in PHP using Zend Framework 2 (and 1)
Manage cloud infrastructures in PHP using Zend Framework 2 (and 1)Manage cloud infrastructures in PHP using Zend Framework 2 (and 1)
Manage cloud infrastructures in PHP using Zend Framework 2 (and 1)Enrico Zimuel
 
You must know about CodeIgniter Popular Library
You must know about CodeIgniter Popular LibraryYou must know about CodeIgniter Popular Library
You must know about CodeIgniter Popular LibraryBo-Yi Wu
 
20120722 word press
20120722 word press20120722 word press
20120722 word pressSeungmin Sun
 
Ростислав Михайлив "Zend Framework 3 - evolution or revolution"
Ростислав Михайлив "Zend Framework 3 - evolution or revolution"Ростислав Михайлив "Zend Framework 3 - evolution or revolution"
Ростислав Михайлив "Zend Framework 3 - evolution or revolution"Fwdays
 
Zend\Expressive - höher, schneller, weiter
Zend\Expressive - höher, schneller, weiterZend\Expressive - höher, schneller, weiter
Zend\Expressive - höher, schneller, weiterRalf Eggert
 
How to build customizable multitenant web applications - PHPBNL11
How to build customizable multitenant web applications - PHPBNL11How to build customizable multitenant web applications - PHPBNL11
How to build customizable multitenant web applications - PHPBNL11Stephan Hochdörfer
 
Apigility reloaded
Apigility reloadedApigility reloaded
Apigility reloadedRalf Eggert
 

Was ist angesagt? (20)

ZF2 Modular Architecture - Taking advantage of it
ZF2 Modular Architecture - Taking advantage of itZF2 Modular Architecture - Taking advantage of it
ZF2 Modular Architecture - Taking advantage of it
 
Get Started with Zend Framework 2
Get Started with Zend Framework 2Get Started with Zend Framework 2
Get Started with Zend Framework 2
 
Manage cloud infrastructures using Zend Framework 2 (and ZF1)
Manage cloud infrastructures using Zend Framework 2 (and ZF1)Manage cloud infrastructures using Zend Framework 2 (and ZF1)
Manage cloud infrastructures using Zend Framework 2 (and ZF1)
 
ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)
ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)
ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)
 
ZFConf 2012: Dependency Management в PHP и Zend Framework 2 (Кирилл Чебунин)
ZFConf 2012: Dependency Management в PHP и Zend Framework 2 (Кирилл Чебунин)ZFConf 2012: Dependency Management в PHP и Zend Framework 2 (Кирилл Чебунин)
ZFConf 2012: Dependency Management в PHP и Zend Framework 2 (Кирилл Чебунин)
 
Zend Framework 2 - presentation
Zend Framework 2 - presentationZend Framework 2 - presentation
Zend Framework 2 - presentation
 
Cryptography with Zend Framework
Cryptography with Zend FrameworkCryptography with Zend Framework
Cryptography with Zend Framework
 
Zend Framework 2 Patterns
Zend Framework 2 PatternsZend Framework 2 Patterns
Zend Framework 2 Patterns
 
Instant ACLs with Zend Framework 2
Instant ACLs with Zend Framework 2Instant ACLs with Zend Framework 2
Instant ACLs with Zend Framework 2
 
ZFConf 2012: Реализация доступа к СУБД IBM DB2 посредством встраиваемого SQL ...
ZFConf 2012: Реализация доступа к СУБД IBM DB2 посредством встраиваемого SQL ...ZFConf 2012: Реализация доступа к СУБД IBM DB2 посредством встраиваемого SQL ...
ZFConf 2012: Реализация доступа к СУБД IBM DB2 посредством встраиваемого SQL ...
 
Manage cloud infrastructures in PHP using Zend Framework 2 (and 1)
Manage cloud infrastructures in PHP using Zend Framework 2 (and 1)Manage cloud infrastructures in PHP using Zend Framework 2 (and 1)
Manage cloud infrastructures in PHP using Zend Framework 2 (and 1)
 
Introduction to Zend Framework
Introduction to Zend FrameworkIntroduction to Zend Framework
Introduction to Zend Framework
 
ZF2 Presentation @PHP Tour 2011 in Lille
ZF2 Presentation @PHP Tour 2011 in LilleZF2 Presentation @PHP Tour 2011 in Lille
ZF2 Presentation @PHP Tour 2011 in Lille
 
You must know about CodeIgniter Popular Library
You must know about CodeIgniter Popular LibraryYou must know about CodeIgniter Popular Library
You must know about CodeIgniter Popular Library
 
20120722 word press
20120722 word press20120722 word press
20120722 word press
 
Ростислав Михайлив "Zend Framework 3 - evolution or revolution"
Ростислав Михайлив "Zend Framework 3 - evolution or revolution"Ростислав Михайлив "Zend Framework 3 - evolution or revolution"
Ростислав Михайлив "Zend Framework 3 - evolution or revolution"
 
Zf2 phpquebec
Zf2 phpquebecZf2 phpquebec
Zf2 phpquebec
 
Zend\Expressive - höher, schneller, weiter
Zend\Expressive - höher, schneller, weiterZend\Expressive - höher, schneller, weiter
Zend\Expressive - höher, schneller, weiter
 
How to build customizable multitenant web applications - PHPBNL11
How to build customizable multitenant web applications - PHPBNL11How to build customizable multitenant web applications - PHPBNL11
How to build customizable multitenant web applications - PHPBNL11
 
Apigility reloaded
Apigility reloadedApigility reloaded
Apigility reloaded
 

Ähnlich wie A quick start on Zend Framework 2

How to Manage Cloud Infrastructures using Zend Framework
How to Manage Cloud Infrastructures using Zend FrameworkHow to Manage Cloud Infrastructures using Zend Framework
How to Manage Cloud Infrastructures using Zend FrameworkZend by Rogue Wave Software
 
Z ray plugins for dummies
Z ray plugins for dummiesZ ray plugins for dummies
Z ray plugins for dummiesDmitry Zbarski
 
Php7 extensions workshop
Php7 extensions workshopPhp7 extensions workshop
Php7 extensions workshopjulien pauli
 
Foundations of Zend Framework
Foundations of Zend FrameworkFoundations of Zend Framework
Foundations of Zend FrameworkAdam Culp
 
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
 
Edp bootstrapping a-software_company
Edp bootstrapping a-software_companyEdp bootstrapping a-software_company
Edp bootstrapping a-software_companyGanesh Kulkarni
 
Zend Framework 1.8 workshop
Zend Framework 1.8 workshopZend Framework 1.8 workshop
Zend Framework 1.8 workshopNick Belhomme
 
Costruire un sito e-commerce in alta affidabilità con Magento e Zend Server C...
Costruire un sito e-commerce in alta affidabilità con Magento e Zend Server C...Costruire un sito e-commerce in alta affidabilità con Magento e Zend Server C...
Costruire un sito e-commerce in alta affidabilità con Magento e Zend Server C...Zend by Rogue Wave Software
 
PHP QA Tools
PHP QA ToolsPHP QA Tools
PHP QA Toolsrjsmelo
 
Eclipse HandsOn Workshop
Eclipse HandsOn WorkshopEclipse HandsOn Workshop
Eclipse HandsOn WorkshopBastian Feder
 
Ansible new paradigms for orchestration
Ansible new paradigms for orchestrationAnsible new paradigms for orchestration
Ansible new paradigms for orchestrationPaolo Tonin
 
Kicking off with Zend Expressive and Doctrine ORM (PHP MiNDS March 2018)
Kicking off with Zend Expressive and Doctrine ORM (PHP MiNDS March 2018)Kicking off with Zend Expressive and Doctrine ORM (PHP MiNDS March 2018)
Kicking off with Zend Expressive and Doctrine ORM (PHP MiNDS March 2018)James Titcumb
 
Kicking off with Zend Expressive and Doctrine ORM (PHP Srbija 2017)
Kicking off with Zend Expressive and Doctrine ORM (PHP Srbija 2017)Kicking off with Zend Expressive and Doctrine ORM (PHP Srbija 2017)
Kicking off with Zend Expressive and Doctrine ORM (PHP Srbija 2017)James Titcumb
 
Kicking off with Zend Expressive and Doctrine ORM (PHP South Africa 2018)
Kicking off with Zend Expressive and Doctrine ORM (PHP South Africa 2018)Kicking off with Zend Expressive and Doctrine ORM (PHP South Africa 2018)
Kicking off with Zend Expressive and Doctrine ORM (PHP South Africa 2018)James Titcumb
 
Building and managing applications fast for IBM i
Building and managing applications fast for IBM iBuilding and managing applications fast for IBM i
Building and managing applications fast for IBM iZend by Rogue Wave Software
 
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)Bastian Feder
 
Head First Zend Framework - Part 1 Project & Application
Head First Zend Framework - Part 1 Project & ApplicationHead First Zend Framework - Part 1 Project & Application
Head First Zend Framework - Part 1 Project & ApplicationJace Ju
 
Kicking off with Zend Expressive and Doctrine ORM (ConFoo YVR 2017)
Kicking off with Zend Expressive and Doctrine ORM (ConFoo YVR 2017)Kicking off with Zend Expressive and Doctrine ORM (ConFoo YVR 2017)
Kicking off with Zend Expressive and Doctrine ORM (ConFoo YVR 2017)James Titcumb
 

Ähnlich wie A quick start on Zend Framework 2 (20)

How to Manage Cloud Infrastructures using Zend Framework
How to Manage Cloud Infrastructures using Zend FrameworkHow to Manage Cloud Infrastructures using Zend Framework
How to Manage Cloud Infrastructures using Zend Framework
 
Z ray plugins for dummies
Z ray plugins for dummiesZ ray plugins for dummies
Z ray plugins for dummies
 
Php7 extensions workshop
Php7 extensions workshopPhp7 extensions workshop
Php7 extensions workshop
 
Foundations of Zend Framework
Foundations of Zend FrameworkFoundations of Zend Framework
Foundations of 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
 
Edp bootstrapping a-software_company
Edp bootstrapping a-software_companyEdp bootstrapping a-software_company
Edp bootstrapping a-software_company
 
Zend Framework 1.8 workshop
Zend Framework 1.8 workshopZend Framework 1.8 workshop
Zend Framework 1.8 workshop
 
Costruire un sito e-commerce in alta affidabilità con Magento e Zend Server C...
Costruire un sito e-commerce in alta affidabilità con Magento e Zend Server C...Costruire un sito e-commerce in alta affidabilità con Magento e Zend Server C...
Costruire un sito e-commerce in alta affidabilità con Magento e Zend Server C...
 
PHP QA Tools
PHP QA ToolsPHP QA Tools
PHP QA Tools
 
Eclipse HandsOn Workshop
Eclipse HandsOn WorkshopEclipse HandsOn Workshop
Eclipse HandsOn Workshop
 
Zend framework
Zend frameworkZend framework
Zend framework
 
Ansible new paradigms for orchestration
Ansible new paradigms for orchestrationAnsible new paradigms for orchestration
Ansible new paradigms for orchestration
 
Kicking off with Zend Expressive and Doctrine ORM (PHP MiNDS March 2018)
Kicking off with Zend Expressive and Doctrine ORM (PHP MiNDS March 2018)Kicking off with Zend Expressive and Doctrine ORM (PHP MiNDS March 2018)
Kicking off with Zend Expressive and Doctrine ORM (PHP MiNDS March 2018)
 
Kicking off with Zend Expressive and Doctrine ORM (PHP Srbija 2017)
Kicking off with Zend Expressive and Doctrine ORM (PHP Srbija 2017)Kicking off with Zend Expressive and Doctrine ORM (PHP Srbija 2017)
Kicking off with Zend Expressive and Doctrine ORM (PHP Srbija 2017)
 
Kicking off with Zend Expressive and Doctrine ORM (PHP South Africa 2018)
Kicking off with Zend Expressive and Doctrine ORM (PHP South Africa 2018)Kicking off with Zend Expressive and Doctrine ORM (PHP South Africa 2018)
Kicking off with Zend Expressive and Doctrine ORM (PHP South Africa 2018)
 
Building and managing applications fast for IBM i
Building and managing applications fast for IBM iBuilding and managing applications fast for IBM i
Building and managing applications fast for IBM i
 
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
 
Head First Zend Framework - Part 1 Project & Application
Head First Zend Framework - Part 1 Project & ApplicationHead First Zend Framework - Part 1 Project & Application
Head First Zend Framework - Part 1 Project & Application
 
Kicking off with Zend Expressive and Doctrine ORM (ConFoo YVR 2017)
Kicking off with Zend Expressive and Doctrine ORM (ConFoo YVR 2017)Kicking off with Zend Expressive and Doctrine ORM (ConFoo YVR 2017)
Kicking off with Zend Expressive and Doctrine ORM (ConFoo YVR 2017)
 
Getting Native with NDK
Getting Native with NDKGetting Native with NDK
Getting Native with NDK
 

Mehr von Enrico Zimuel

Password (in)security
Password (in)securityPassword (in)security
Password (in)securityEnrico Zimuel
 
Integrare Zend Framework in Wordpress
Integrare Zend Framework in WordpressIntegrare Zend Framework in Wordpress
Integrare Zend Framework in WordpressEnrico Zimuel
 
Introduzione alla Posta Elettronica Certificata (PEC): le regole tecniche
Introduzione alla Posta Elettronica Certificata (PEC): le regole tecnicheIntroduzione alla Posta Elettronica Certificata (PEC): le regole tecniche
Introduzione alla Posta Elettronica Certificata (PEC): le regole tecnicheEnrico Zimuel
 
Cryptography in PHP: use cases
Cryptography in PHP: use casesCryptography in PHP: use cases
Cryptography in PHP: use casesEnrico Zimuel
 
Framework software e Zend Framework
Framework software e Zend FrameworkFramework software e Zend Framework
Framework software e Zend FrameworkEnrico Zimuel
 
Strong cryptography in PHP
Strong cryptography in PHPStrong cryptography in PHP
Strong cryptography in PHPEnrico Zimuel
 
How to scale PHP applications
How to scale PHP applicationsHow to scale PHP applications
How to scale PHP applicationsEnrico Zimuel
 
Velocizzare Joomla! con Zend Server Community Edition
Velocizzare Joomla! con Zend Server Community EditionVelocizzare Joomla! con Zend Server Community Edition
Velocizzare Joomla! con Zend Server Community EditionEnrico Zimuel
 
Zend_Cache: how to improve the performance of PHP applications
Zend_Cache: how to improve the performance of PHP applicationsZend_Cache: how to improve the performance of PHP applications
Zend_Cache: how to improve the performance of PHP applicationsEnrico Zimuel
 
XCheck a benchmark checker for XML query processors
XCheck a benchmark checker for XML query processorsXCheck a benchmark checker for XML query processors
XCheck a benchmark checker for XML query processorsEnrico Zimuel
 
Introduzione alle tabelle hash
Introduzione alle tabelle hashIntroduzione alle tabelle hash
Introduzione alle tabelle hashEnrico Zimuel
 
Crittografia quantistica: fantascienza o realtà?
Crittografia quantistica: fantascienza o realtà?Crittografia quantistica: fantascienza o realtà?
Crittografia quantistica: fantascienza o realtà?Enrico Zimuel
 
Introduzione alla crittografia
Introduzione alla crittografiaIntroduzione alla crittografia
Introduzione alla crittografiaEnrico Zimuel
 
Crittografia è sinonimo di sicurezza?
Crittografia è sinonimo di sicurezza?Crittografia è sinonimo di sicurezza?
Crittografia è sinonimo di sicurezza?Enrico Zimuel
 
Sviluppo di applicazioni sicure
Sviluppo di applicazioni sicureSviluppo di applicazioni sicure
Sviluppo di applicazioni sicureEnrico Zimuel
 
Misure minime di sicurezza informatica
Misure minime di sicurezza informaticaMisure minime di sicurezza informatica
Misure minime di sicurezza informaticaEnrico Zimuel
 
La sicurezza delle applicazioni in PHP
La sicurezza delle applicazioni in PHPLa sicurezza delle applicazioni in PHP
La sicurezza delle applicazioni in PHPEnrico Zimuel
 

Mehr von Enrico Zimuel (20)

Password (in)security
Password (in)securityPassword (in)security
Password (in)security
 
Integrare Zend Framework in Wordpress
Integrare Zend Framework in WordpressIntegrare Zend Framework in Wordpress
Integrare Zend Framework in Wordpress
 
Introduzione alla Posta Elettronica Certificata (PEC): le regole tecniche
Introduzione alla Posta Elettronica Certificata (PEC): le regole tecnicheIntroduzione alla Posta Elettronica Certificata (PEC): le regole tecniche
Introduzione alla Posta Elettronica Certificata (PEC): le regole tecniche
 
PHP goes mobile
PHP goes mobilePHP goes mobile
PHP goes mobile
 
Zend Framework 2
Zend Framework 2Zend Framework 2
Zend Framework 2
 
Cryptography in PHP: use cases
Cryptography in PHP: use casesCryptography in PHP: use cases
Cryptography in PHP: use cases
 
Framework software e Zend Framework
Framework software e Zend FrameworkFramework software e Zend Framework
Framework software e Zend Framework
 
Strong cryptography in PHP
Strong cryptography in PHPStrong cryptography in PHP
Strong cryptography in PHP
 
How to scale PHP applications
How to scale PHP applicationsHow to scale PHP applications
How to scale PHP applications
 
Velocizzare Joomla! con Zend Server Community Edition
Velocizzare Joomla! con Zend Server Community EditionVelocizzare Joomla! con Zend Server Community Edition
Velocizzare Joomla! con Zend Server Community Edition
 
Zend_Cache: how to improve the performance of PHP applications
Zend_Cache: how to improve the performance of PHP applicationsZend_Cache: how to improve the performance of PHP applications
Zend_Cache: how to improve the performance of PHP applications
 
XCheck a benchmark checker for XML query processors
XCheck a benchmark checker for XML query processorsXCheck a benchmark checker for XML query processors
XCheck a benchmark checker for XML query processors
 
Introduzione alle tabelle hash
Introduzione alle tabelle hashIntroduzione alle tabelle hash
Introduzione alle tabelle hash
 
Crittografia quantistica: fantascienza o realtà?
Crittografia quantistica: fantascienza o realtà?Crittografia quantistica: fantascienza o realtà?
Crittografia quantistica: fantascienza o realtà?
 
Introduzione alla crittografia
Introduzione alla crittografiaIntroduzione alla crittografia
Introduzione alla crittografia
 
Crittografia è sinonimo di sicurezza?
Crittografia è sinonimo di sicurezza?Crittografia è sinonimo di sicurezza?
Crittografia è sinonimo di sicurezza?
 
Sviluppo di applicazioni sicure
Sviluppo di applicazioni sicureSviluppo di applicazioni sicure
Sviluppo di applicazioni sicure
 
Misure minime di sicurezza informatica
Misure minime di sicurezza informaticaMisure minime di sicurezza informatica
Misure minime di sicurezza informatica
 
PHP e crittografia
PHP e crittografiaPHP e crittografia
PHP e crittografia
 
La sicurezza delle applicazioni in PHP
La sicurezza delle applicazioni in PHPLa sicurezza delle applicazioni in PHP
La sicurezza delle applicazioni in PHP
 

Kürzlich hochgeladen

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
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
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
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
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 

Kürzlich hochgeladen (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
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...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
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...
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 

A quick start on Zend Framework 2

  • 1. A quick start on Zend Framework 2 by Enrico Zimuel (enrico@zend.com) Senior Software Engineer Zend Framework Core Team Zend Technologies Ltd 19th May 2012 Verona (Italy) © All rights reserved. Zend Technologies, Inc.
  • 2. About me • Enrico Zimuel (@ezimuel) • Software Engineer since 1996 – Assembly x86, C/C++, Java, Perl, PHP • PHP Engineer at Zend in the Zend Framework Core Team • International speaker about PHP and computer security topics • Co-author of the italian book “PHP Best practices” (FAG edizioni) • Co-founder of the PUG Torino © All rights reserved. Zend Technologies, Inc.
  • 3. ZF2 in a slide ● New architecture (MVC, Di, Events) ● Requirement: PHP 5.3.3 ● No more CLA (Contributor License Agreement) ● Git (GitHub) instead of SVN ● Better performance (new autoload) ● Module support ● Packaging system (pyrus) © All rights reserved. Zend Technologies, Inc.
  • 4. A new core ● The ZF1 way: ▶ Singleton, Registry, and Hard- Coded Dependencies ● The ZF2 approach: ▶ Aspect Oriented Design and Dependency Injection © All rights reserved. Zend Technologies, Inc.
  • 5. New architectural approach ● Methodologies used in the development – Decoupling (ZendDi) – Event driven (ZendEventManager) – Standard classes (ZendStdlib) ● Take advantage of PHP 5.3 ▶ Namespace ▶ Lambda Functions and Closures ▶ Better performance © All rights reserved. Zend Technologies, Inc.
  • 6. Releases ● ZF2.0.0beta4 next week! ● Goal: ▶ beta5 on June ▶ ZF 2.0 RC this summer!!! © All rights reserved. Zend Technologies, Inc.
  • 7. Autoloading © All rights reserved. Zend Technologies, Inc.
  • 8. Autoloading ● No more require_once calls! ● Multiple approaches: – ZF1-style include_path autoloader – Per-namespace/prefix autoloading – Class-map autoloading © All rights reserved. Zend Technologies, Inc.
  • 9. ZF1-Style require_once 'Zend/Loader/StandardAutoloader.php'; $loader = new ZendLoaderStandardAutoloader(array( 'fallback_autoloader' => true, )); $loader->register(); © All rights reserved. Zend Technologies, Inc.
  • 10. ZF2 NS/Prefix require_once 'Zend/Loader/StandardAutoloader.php'; $loader = new ZendLoaderStandardAutoloader(); $loader->registerNamespace( 'My', __DIR__ . '/../library/My') ->registerPrefix( 'Foo_', __DIR__ . '/../library/Foo'); $loader->register(); © All rights reserved. Zend Technologies, Inc.
  • 11. ZF2 Class-Map return array( 'MyFooBar' => __DIR__ . '/Foo/Bar.php', ); .classmap.php require_once 'Zend/Loader/ClassMapAutoloader.php'; $loader = new ZendLoaderClassMapAutoloader(); $loader->registerAutoloadMap( __DIR__ . '/../library/.classmap.php'); $loader->register(); © All rights reserved. Zend Technologies, Inc.
  • 12. Classmap generator ● How to generate the .classmap.php? We provided a command line tool: bin/classmap_generator.php ● Usage is trivial: $ cd your/library $ php /path/to/classmap_generator.php -w ● Class-Map will be created in .classmap.php © All rights reserved. Zend Technologies, Inc.
  • 13. Performance improvement ● Compared with the ZF1 autoloader ▶ Class-Maps show a 25-85% improvement ▶ Namespaces/prefixes shows 10-40% improvement Note: The new autoloading system of ZF2 has been ported to ZF 1.12 © All rights reserved. Zend Technologies, Inc.
  • 14. Dependency Injection © All rights reserved. Zend Technologies, Inc.
  • 15. ZendDi ● Supports the 3 different injection patterns: – Constructor – Interface – Setter ● Implements a Di Container: – Manage the dependencies using configuration and annotation – Provide a compiler to autodiscover classes in a path and create the class definitions, for dependencies © All rights reserved. Zend Technologies, Inc.
  • 16. Example class Bar { … } class Foo { protected $bar; … public function setBar(Bar $bar) { $this->bar = $bar; } … } © All rights reserved. Zend Technologies, Inc.
  • 17. Sample definition $definition = array( 'Foo' => array( 'setBar' => array( 'bar' => array( 'type' => 'Bar', 'required' => true, ), ), ), ); © All rights reserved. Zend Technologies, Inc.
  • 18. Using the Di container use ZendDiDi, ZendDiConfiguration; $di = new Di; $config = new Configuration(array( 'definition' => array('class' => $definition) )); $config->configure($di); $foo = $di->get('Foo'); // contains Bar! © All rights reserved. Zend Technologies, Inc.
  • 19. Di by annotation use ZendDiDefinitionAnnotation as Di; class Foo { protected $bar; /** * @DiInject() */ public function setBar(Bar $bar){ $this->bar = $bar; } } class Bar { ... } © All rights reserved. Zend Technologies, Inc.
  • 20. Di by annotation (2) $compiler = new ZendDiDefinitionCompilerDefinition(); $compiler->addDirectory('File path of Foo and Bar'); $compiler->compile(); $definitions = new ZendDiDefinitionList($compiler); $di = new ZendDiDi($definitions); $baz = $di->get('Foo'); // contains Bar! More use cases of ZendDi: https://github.com/ralphschindler/zf2-di-use-cases © All rights reserved. Zend Technologies, Inc.
  • 21. Event Manager © All rights reserved. Zend Technologies, Inc.
  • 22. Event Manager ● An Event Manager is an object that aggregates listeners for one or more named events, and which triggers events. ● A Listener is a callback that can react to an event. ● An Event is an action. © All rights reserved. Zend Technologies, Inc.
  • 23. Example use ZendEventManagerEventManager; $events = new EventManager(); $events->attach('do', function($e) { $event = $e->getName(); $params = $e->getParams(); printf( 'Handled event “%s”, with parameters %s', $event, json_encode($params) ); }); $params = array('foo' => 'bar', 'baz' => 'bat'); $events->trigger('do', null, $params); © All rights reserved. Zend Technologies, Inc.
  • 24. MVC © All rights reserved. Zend Technologies, Inc.
  • 25. Event driven architecture ● Everything is an event in the MVC architecture of ZF2 © All rights reserved. Zend Technologies, Inc.
  • 26. Module definition “A module is a collection of code and other files that solves a more specific atomic problem of the larger business problem.” (from the ZF2 RFC) © All rights reserved. Zend Technologies, Inc.
  • 27. Module for ZF2 ● The basic unit in a ZF2 application is a Module ● Modules are “Plug and play” technology ● Modules are simple: ▶ A namespace ▶ Containing a single classfile: Module.php © All rights reserved. Zend Technologies, Inc.
  • 28. Quick start Zend Skeleton Application © All rights reserved. Zend Technologies, Inc.
  • 29. Zend Skeleton Application ● A simple, skeleton application using the new MVC layer and the module system ● Github: ▶ git clone --recursive git://github.com/zendframework/ZendSkeletonApplication.git ● This project makes use of Git submodules ● Ready for ZF2.0.0beta4 © All rights reserved. Zend Technologies, Inc.
  • 30. Folder's tree config data module public vendor © All rights reserved. Zend Technologies, Inc.
  • 31. Config folder config autoload application.config.php data module public vendor © All rights reserved. Zend Technologies, Inc.
  • 32. Data folder config data cache module public vendor © All rights reserved. Zend Technologies, Inc.
  • 33. Module folder module Application Name of the module config module.config.php src Application Controller IndexController.php view index index.phtml Module.php autoload_classmap.php autoload_functions.php autoload_registers.php © All rights reserved. Zend Technologies, Inc.
  • 34. Public folder public images js css .htaccess index.php © All rights reserved. Zend Technologies, Inc.
  • 35. Vendor folder config data module public vendor ZendFramework © All rights reserved. Zend Technologies, Inc.
  • 36. .htaccess RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ index.php [NC,L] © All rights reserved. Zend Technologies, Inc.
  • 37. index.php chdir(dirname(__DIR__)); require_once (getenv('ZF2_PATH') ?: 'vendor/ZF/library') . '/Zend/Loader/AutoloaderFactory.php'; use ZendLoaderAutoloaderFactory, ZendServiceManagerServiceManager, ZendMvcServiceServiceManagerConfiguration; AutoloaderFactory::factory(); $config = include 'config/application.config.php'; $serviceManager = new ServiceManager(new ServiceManagerConfiguration( $config['service_manager'])); $serviceManager->setService('ApplicationConfiguration', $config); $serviceManager->get('ModuleManager')->loadModules(); $serviceManager->get('Application')->bootstrap()->run()->send(); © All rights reserved. Zend Technologies, Inc.
  • 38. application.config.php return array( 'modules' => array( 'Application', ), 'module_listener_options' => array( 'config_cache_enabled' => false, 'cache_dir' => 'data/cache', 'module_paths' => array( './module', './vendor', ), ), 'service_manager' => array( 'use_defaults' => true, 'factories' => array(), ), ); © All rights reserved. Zend Technologies, Inc.
  • 39. Module.php namespace Application; class Module { public function getAutoloaderConfig() { return array( 'ZendLoaderClassMapAutoloader' => array( __DIR__ . '/autoload_classmap.php', ), 'ZendLoaderStandardAutoloader' => array( 'namespaces' => array( __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__, ), ), ); } public function getConfig() { return include __DIR__ . '/config/module.config.php'; } } © All rights reserved. Zend Technologies, Inc.
  • 40. autoload_classmap.php return array( 'ApplicationControllerIndexController' => __DIR__ . '/src/Application/Controller/IndexController.php', 'ApplicationModule' => __DIR__ . '/Module.php', ); © All rights reserved. Zend Technologies, Inc.
  • 41. module.config.php return array( 'router' => array( 'routes' => array( 'default' => array( 'type' => 'ZendMvcRouterHttpSegment', 'options' => array( 'route' => '/[:controller[/:action]]', 'constraints' => array( 'controller' => '[a-zA-Z][a-zA-Z0-9_-]*', 'action' => '[a-zA-Z][a-zA-Z0-9_-]*', ), 'defaults' => array( 'controller' => 'IndexController', 'action' => 'index', ),),), 'home' => array( 'type' => 'ZendMvcRouterHttpLiteral', 'options' => array( 'route' => '/', 'defaults' => array( 'controller' => 'IndexController', 'action' => 'index', ),),),),), © All rights reserved. Zend Technologies, Inc.
  • 42. module.config.php (2) 'controller' => array( 'classes' => array( 'IndexController' => 'ApplicationControllerIndexController' ), ), 'view_manager' => array( 'display_not_found_reason' => true, 'display_exceptions' => true, 'doctype' => 'HTML5', 'not_found_template' => 'error/404', 'exception_template' => 'error/index', 'template_map' => array( 'layout/layout' => __DIR__ . '/../view/layout/layout.phtml', 'index/index' => __DIR__ . '/../view/index/index.phtml', 'error/404' => __DIR__ . '/../view/error/404.phtml', 'error/index' => __DIR__ . '/../view/error/index.phtml', ), 'template_path_stack' => array( 'application' => __DIR__ . '/../view', ), ), ); © All rights reserved. Zend Technologies, Inc.
  • 43. IndexController.php namespace ApplicationController; use ZendMvcControllerActionController, ZendViewModelViewModel; class IndexController extends ActionController { public function indexAction() { return new ViewModel(); } } © All rights reserved. Zend Technologies, Inc.
  • 44. Packaging system © All rights reserved. Zend Technologies, Inc.
  • 45. Source package ● http://packages.zendframework.com/ ● Download or use pyrus, a PEAR2 installer ● Pyrus packages: ▶ Pyrus setup ▶ wget http://packages.zendframework.com/pyrus.phar ▶ pyrus.phar . ▶ pyrus.phar . channel­discover packages.zendframework.com ▶ Install a Zend_<component> ▶ pyrus.phar . install zf2/Zend_<component> © All rights reserved. Zend Technologies, Inc.
  • 46. From ZF1 to ZF2 © All rights reserved. Zend Technologies, Inc.
  • 47. Migrate to ZF2 ● Goal: migrate without rewriting much code! ● Main steps – Namespace: Zend_Foo => ZendFoo – Exceptions: an Interface for each components, no more Zend_Exception – Autoloading: 3 options (one is ZF1) – MVC: module, event based, dispatchable – DB: new ZendDb – Form: new ZendForm © All rights reserved. Zend Technologies, Inc.
  • 48. ZF1 migration prototype ● Source code: http://bit.ly/pvc0X1 ● Creates a "Zf1Compat" version of the ZF1 dispatcher as an event listener. ● The bootstrap largely mimics how ZF1's Zend_Application bootstrap works. ● The default route utilizes the new ZF2 MVC routing, but mimics what ZF1 provided © All rights reserved. Zend Technologies, Inc.
  • 49. How to contribute © All rights reserved. Zend Technologies, Inc.
  • 50. We want you! ● How to contribute: ▶ Write code ▶ Documentation ▶ Testing ▶ Feedbacks/comments https://github.com/zendframework/zf2 © All rights reserved. Zend Technologies, Inc.
  • 51. Helping out ● http://framework.zend.com/zf2 ● http://github.com/zendframework ● https://github.com/zendframework/ZendSkeletonApplication ● Getting Started with Zend Framework 2 by Rob Allen, http://www.akrabat.com ● Weekly IRC meetings (#zf2-meeting on Freenode) ● #zftalk.2 on Freenode IRC © All rights reserved. Zend Technologies, Inc.
  • 52. Thank you! ● Vote this talk: ▶ https://joind.in/6384 ● Comments and feedbacks: ▶ enrico@zend.com © All rights reserved. Zend Technologies, Inc.