SlideShare a Scribd company logo
1 of 68
Download to read offline
2010/03/06 id:heavenshell
wozozo




 …
id:heavenshell (3/6                   )



  http://d.hatena.ne.jp/heavenshell

  http://twitter.com/heavenshell

  http://github.com/heavenshell

  http://openpear.org/maintainer/heavenshell

                    Java                  (Cubby   )

  Python, JavaScript, Vim
2007                 (        )



(PEAR::Pager    ) → Phwittr

 Ver1.5



 Ver1.8   Zend_Application
Zend_Application



                   (2009/10)



  1.10
Zend_Application



                   (2009/10)



  1.10
Doctrine




  Doctrine   Doctrine   …

                   ←
ASP                    (         )

        CRUD




cron

               (JavaScript)       API
Zend Framework        1.9x

  http://github.com/heavenshell/gene
Zend_Db, Revulo_View_Phtmlc

  Doctrine                   Twig

             Github           web-app-theme
http://github.com/pilu/web-app-theme
app
  |-- Gene.php
  |-- config
  |-- layouts
  | |-- admin
  | `-- index
  |-- locales
  | `-- ja
  |-- models
  | |-- Tables
  | `-- Tables.php
  |-- modules
  | |-- admin
  | |-- api
  | `-- index
  |-- plugins
  | `-- Gene
  |-- services
  `-- views
       `-- scripts
app
  |-- Gene.php
  |-- config
  |-- layouts
  | |-- admin
  | `-- index
  |-- locales
  | `-- ja
  |-- models         Zend_Db (   Dao)
  | |-- Tables
  | `-- Tables.php
  |-- modules
  | |-- admin
  | |-- api
  | `-- index
  |-- plugins
  | `-- Gene
  |-- services
  `-- views
       `-- scripts
app
  |-- Gene.php
  |-- config
  |-- layouts
  | |-- admin
  | `-- index
  |-- locales
  | `-- ja
  |-- models         Zend_Db (    Dao)
  | |-- Tables
  | `-- Tables.php
  |-- modules         Zend_Controller
  | |-- admin
  | |-- api
  | `-- index
  |-- plugins
  | `-- Gene
  |-- services
  `-- views
       `-- scripts
app
  |-- Gene.php
  |-- config
  |-- layouts
  | |-- admin
  | `-- index
  |-- locales
  | `-- ja
  |-- models         Zend_Db (       Dao)
  | |-- Tables
  | `-- Tables.php
  |-- modules         Zend_Controller
  | |-- admin
  | |-- api
  | `-- index
  |-- plugins
  | `-- Gene                     (          )
  |-- services
  `-- views
       `-- scripts
app
  |-- Gene.php
  |-- config
  |-- layouts
  | |-- admin
  | `-- index
  |-- locales
  | `-- ja
  |-- models         Zend_Db (       Dao)
  | |-- Tables
  | `-- Tables.php
  |-- modules         Zend_Controller
  | |-- admin
  | |-- api
  | `-- index
  |-- plugins
  | `-- Gene                     (          )
  |-- services
  `-- views
       `-- scripts
modules

          application
Plugin
 Zend_Controller_Plugin_Abstract

                    (              )



   CSRF

            ○○
Zend_Auth::getInstance()->getIdentity();
Q4M
 Openpear::Net_Q4M
                           …

 Zend_Queue

  Zend_Queue_Adapter_Q4m
1.7x
Zend Framework         use-at-will




                   DB, View, Session, Routing,
             etc
1.8

Zend_Application



  Dependency Injection
           noopable

1.7
Storefront (http://www.thepopeisdead.com/)
  Zend_Application

zfdebugdoctrine (http://github.com/danceric/zfdebugdoctrine)
  ZFDebug          Doctrine
Magento (http://www.magentocommerce.com/)
  OSS       EC

Live Commerce (http://www.live-commerce.com/)
              OSS

TomatoCMS (http://tomatocms.com/)
  OSS       CMS
Zend_Application_Bootstrap_Bootstrap



application.ini                      ini

                                    application/
Bootstrap.php
Zend_Application_Bootstrap_Bootstrap
[application.ini]
bootstrap.path = GENE_LIB_PATH "/Bootstrap.php"
bootstrap.class = "Gene_Bootstrap"
 application.ini        ↓              ini

bootstrap.path = GENE_APP_PATH "/Phwitter.php"
                                  application/
bootstrap.class = "Phwittr"
Bootstrap.php
(         junichiro
                      )

Zend_Db, Doctrine
                (           Zend_Db)

View                              (ry

Zend_Log       Zend_Cache
…
Validation
 Zend_Filter_Input
      (Zend_Form     )



 Zend_Translate
FW   ini



           Zend_Translate
$requests = array('name' => 'hogehogehoge');
$validations = array(
   'name' => array(
       new Zend_Validate_StringLength(1, 10, 'utf-8'),
       'messages' => array(
          0 => $translate->_('User name should enter less than 100.'),
     )
   )
);
$validator = new Zend_Filter_Input(null, $validation);
$valid = $validator->setData($requests)->isValid();
var_dump($input->getInvalid());
$requests = array('name' => 'hogehogehoge');
$validations = array(
   'name' => array(
       new Zend_Validate_StringLength(1, 10, 'utf-8'),
       'messages' => array(
          0 => $translate->_('User name should enter less than 100.'),
     )
   )
);
        Zend_Translate
$validator = new Zend_Filter_Input(null, $validation);
$valid = $validator->setData($requests)->isValid();
var_dump($input->getInvalid());
$requests = array('name' => 'hogehogehoge');
$validations = array(
   'name' => array(
       new Zend_Validate_StringLength(1, 10, 'utf-8'),
       'messages' => array(
          0 => $translate->_('User name should enter less than 100.'),
     )
   )
);
        Zend_Translate
$validator = new Zend_Filter_Input(null, $validation);
$valid = $validator->setData($requests)->isValid();
var_dump($input->getInvalid());
$requests = array('name' => 'hogehogehoge');
$validations = array(
   'name' => array(
       new Zend_Validate_StringLength(1, 10, 'utf-8'),
       'messages' => array(
          0 => $translate->_('User name should enter less than 100.'),
     )
   )
);
        Zend_Translate
$validator = new Zend_Filter_Input(null, $validation);
$valid = $validator->setData($requests)->isValid();
var_dump($input->getInvalid());

array(1) {
 ["name"]=>
 array(1) {
  ["stringLengthTooLong"]=>
  string(42) "          10                                 "
}
$requests = array('name' => 'hogehogehoge');
$validations = array(
   'name' => array(
       new Zend_Validate_StringLength(1, 10, 'utf-8'),
       'messages' => array(
          0 => $translate->_('User name should enter less than 100.'),
     )
   )
);
        Zend_Translate
$validator = new Zend_Filter_Input(null, $validation);
$valid = $validator->setData($requests)->isValid();
var_dump($input->getInvalid());

array(1) {
 ["name"]=>
 array(1) {
  ["stringLengthTooLong"]=>
  string(42) "          10                                 "
}
$requests = array('email' => 'example@example.c');
$validations = array(
   'email' => array(
       new Zend_Validate_EmailAddress(),
       'messages' => array(
           0 => $translate->_('Email is invaild.'),
        )
     )
   )
);
$validator = new Zend_Filter_Input(null, $validation);
$valid = $validator->setData($requests)->isValid();
var_dump($input->getInvalid());
$requests = array('email' => 'example@example.c');
$validations = array(
   'email' => array(
       new Zend_Validate_EmailAddress(),
       'messages' => array(
           0 => $translate->_('Email is invaild.'),
        )
     )
   )
);
$validator = new Zend_Filter_Input(null, $validation);
$valid = $validator->setData($requests)->isValid();
var_dump($input->getInvalid());
array(1) {
 ["email"]=>
 array(1) {
  ["emailAddressInvalidHostname"]=>
  string(26) "                      "
    }
}
array(1) {
 ["email"]=>
 array(1) {
  ["emailAddressInvalidHostname"]=>
  string(26) "                      "
    }
}
_




| ∪       __   __       J|             _
      u        ´             ||            |
                                  ||           |




                    ●
| ∪       __   __       J|             _
      u        ´             ||            |
                                  ||           |
array(1) {
  ["email"]=>
  array(3) {
    ["emailAddressInvalidHostname"]=>
    string(70) "'example.c' is no valid hostname for email address
'example@example.c'"
    ["hostnameUndecipherableTld"]=>
    string(68) "'example.c' appears to be a DNS hostname but cannot extract
TLD part"
    ["hostnameLocalNameNotAllowed"]=>
    string(86) "'example.c' appears to be a local network name but local
network names are not allowed"
  }
}
::::::
   ::::::::       ○              ○
|::::::::::::::::::::       __       __   ::::    |   _
 :::::::::            |r -|                 ||            |
   ::::::::::::         `    '´                  ||           |
::::::
   ::::::::       ○              ○
|::::::::::::::::::::       __       __   ::::    |   _
 :::::::::            |r -|                 ||            |
   ::::::::::::         `    '´                  ||           |
Zend_Validation_EmailAddress
Zend_Translate

                            translate
  Zend_Validate_Abstract

Zend_Validate_Abstract::setDefaultTranslator($transla
te);
1.9x, 1.10x

  http://github.com/heavenshell/gene/blob/0.2/app/
  locales/ja/validate.ini
  http://github.com/heavenshell/zf-resources-lang-ja/
  blob/master/Zend_Validate.php
         typo                          <(_ _)>
[Ver1.9x]
$locale = new Zend_Locale();
$path = '/path/to/ja/file.ini';
$translate = new Zend_Translate('ini', $path, $locale);
Zend_Validate_Abstract::setDefaultTranslator($translate);

[Ver1.10x]
$locale = new Zend_Locale();
$path = '/path/to/resources/languages';
$scan = array('scan' => Zend_Translate::LOCALE_DIRECTORY);
$translate = new Zend_Translate('array', $path, $locale, $scan);
Zend_Validate_Abstract::setDefaultTranslator($translate);
[Ver1.9x]
$locale = new Zend_Locale();
$path = '/path/to/ja/file.ini';
$translate = new Zend_Translate('ini', $path, $locale);
Zend_Validate_Abstract::setDefaultTranslator($translate);

[Ver1.10x]                                            array()
$locale = new Zend_Locale();
$path = '/path/to/resources/languages';
$scan = array('scan' => Zend_Translate::LOCALE_DIRECTORY);
$translate = new Zend_Translate('array', $path, $locale, $scan);
Zend_Validate_Abstract::setDefaultTranslator($translate);
→   (   )
trunk
"                 '%value%'       '%hostname%'
                              "



Zend_Validate.php




    Zend_Translate#addTranslation()
return array(
  ''%hostname%' is no valid hostname for email address '%value%'' => '
                                            ///'
);

$locale = new Zend_Locale();
$path = '/path/to/resources/languages';
$scan = array('scan' => Zend_Translate::LOCALE_DIRECTORY);
$translate = new Zend_Translate('array', $path, $locale, $scan);
$anotherpath = '/path/to/resources/languages' . $lang . '/Another.php';
$translate->addTranslation($anotherpath);
Zend_Validate_Abstract::setDefaultTranslator($translate);

array(3) {
 ["emailAddressInvalidHostname"]=>
 string(72) "                                               ///"
     ["hostnameUndecipherableTld"]=>
     string(82) "'examlpe.c' DNS                     TLD                  "
     ["hostnameLocalNameNotAllowed"]=>
     string(126) " 'examle.c'
                            "
}
return array(
  ''%hostname%' is no valid hostname for email address '%value%'' => '
                                            ///'
);

$locale = new Zend_Locale();
$path = '/path/to/resources/languages';
$scan = array('scan' => Zend_Translate::LOCALE_DIRECTORY);
$translate = new Zend_Translate('array', $path, $locale, $scan);
$anotherpath = '/path/to/resources/languages' . $lang . '/Another.php';
$translate->addTranslation($anotherpath);
Zend_Validate_Abstract::setDefaultTranslator($translate);

array(3) {
 ["emailAddressInvalidHostname"]=>
 string(72) "                                               ///"
     ["hostnameUndecipherableTld"]=>
     string(82) "'examlpe.c' DNS                     TLD                  "
     ["hostnameLocalNameNotAllowed"]=>
     string(126) " 'examle.c'
                            "
}
return array(
  ''%hostname%' is no valid hostname for email address '%value%'' => '
                                            ///'
);

$locale = new Zend_Locale();
$path = '/path/to/resources/languages';
$scan = array('scan' => Zend_Translate::LOCALE_DIRECTORY);
$translate = new Zend_Translate('array', $path, $locale, $scan);
$anotherpath = '/path/to/resources/languages' . $lang . '/Another.php';
$translate->addTranslation($anotherpath);
Zend_Validate_Abstract::setDefaultTranslator($translate);

array(3) {
 ["emailAddressInvalidHostname"]=>
 string(72) "                                               ///"
     ["hostnameUndecipherableTld"]=>
     string(82) "'examlpe.c' DNS                     TLD                  "
     ["hostnameLocalNameNotAllowed"]=>
     string(126) " 'examle.c'
                            "
}
CRUD



  →        →   x(     +    )x



Scafford
FW




TDD
PHPUnit

Stagehand_Testrunner



                                 …



                …
CRUD



     →   →       x(   +   )

DB

 FW (        )                …
Zend Framework

                  Zend_Application




 Zend_Translate



                       (    )
Any questions?

More Related Content

What's hot

関西アンカンファレンス PHP ではじめるテストコード
関西アンカンファレンス PHP ではじめるテストコード関西アンカンファレンス PHP ではじめるテストコード
関西アンカンファレンス PHP ではじめるテストコードShinya Ohyanagi
 
Smolder @Silex
Smolder @SilexSmolder @Silex
Smolder @SilexJeen Lee
 
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐいHisateru Tanaka
 
Security 202 - Are you sure your site is secure?
Security 202 - Are you sure your site is secure?Security 202 - Are you sure your site is secure?
Security 202 - Are you sure your site is secure?ConFoo
 
Php in 2013 (Web-5 2013 conference)
Php in 2013 (Web-5 2013 conference)Php in 2013 (Web-5 2013 conference)
Php in 2013 (Web-5 2013 conference)julien pauli
 
Looping the Loop with SPL Iterators
Looping the Loop with SPL IteratorsLooping the Loop with SPL Iterators
Looping the Loop with SPL IteratorsMark Baker
 
PHP7 - Scalar Type Hints & Return Types
PHP7 - Scalar Type Hints & Return TypesPHP7 - Scalar Type Hints & Return Types
PHP7 - Scalar Type Hints & Return TypesEric Poe
 
PHP Tips for certification - OdW13
PHP Tips for certification - OdW13PHP Tips for certification - OdW13
PHP Tips for certification - OdW13julien pauli
 
Marrow: A Meta-Framework for Python 2.6+ and 3.1+
Marrow: A Meta-Framework for Python 2.6+ and 3.1+Marrow: A Meta-Framework for Python 2.6+ and 3.1+
Marrow: A Meta-Framework for Python 2.6+ and 3.1+ConFoo
 
The why and how of moving to PHP 5.4/5.5
The why and how of moving to PHP 5.4/5.5The why and how of moving to PHP 5.4/5.5
The why and how of moving to PHP 5.4/5.5Wim Godden
 
Just-In-Time Compiler in PHP 8
Just-In-Time Compiler in PHP 8Just-In-Time Compiler in PHP 8
Just-In-Time Compiler in PHP 8Nikita Popov
 
I, For One, Welcome Our New Perl6 Overlords
I, For One, Welcome Our New Perl6 OverlordsI, For One, Welcome Our New Perl6 Overlords
I, For One, Welcome Our New Perl6 Overlordsheumann
 
The why and how of moving to PHP 5.5/5.6
The why and how of moving to PHP 5.5/5.6The why and how of moving to PHP 5.5/5.6
The why and how of moving to PHP 5.5/5.6Wim Godden
 
How to deploy node to production
How to deploy node to productionHow to deploy node to production
How to deploy node to productionSean Hess
 
IPC2010SE Doctrine2 Enterprise Persistence Layer for PHP
IPC2010SE Doctrine2 Enterprise Persistence Layer for PHPIPC2010SE Doctrine2 Enterprise Persistence Layer for PHP
IPC2010SE Doctrine2 Enterprise Persistence Layer for PHPGuilherme Blanco
 

What's hot (20)

関西アンカンファレンス PHP ではじめるテストコード
関西アンカンファレンス PHP ではじめるテストコード関西アンカンファレンス PHP ではじめるテストコード
関西アンカンファレンス PHP ではじめるテストコード
 
Smolder @Silex
Smolder @SilexSmolder @Silex
Smolder @Silex
 
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい
 
New in php 7
New in php 7New in php 7
New in php 7
 
Security 202 - Are you sure your site is secure?
Security 202 - Are you sure your site is secure?Security 202 - Are you sure your site is secure?
Security 202 - Are you sure your site is secure?
 
Php in 2013 (Web-5 2013 conference)
Php in 2013 (Web-5 2013 conference)Php in 2013 (Web-5 2013 conference)
Php in 2013 (Web-5 2013 conference)
 
Looping the Loop with SPL Iterators
Looping the Loop with SPL IteratorsLooping the Loop with SPL Iterators
Looping the Loop with SPL Iterators
 
PHP7 - Scalar Type Hints & Return Types
PHP7 - Scalar Type Hints & Return TypesPHP7 - Scalar Type Hints & Return Types
PHP7 - Scalar Type Hints & Return Types
 
PHP Tips for certification - OdW13
PHP Tips for certification - OdW13PHP Tips for certification - OdW13
PHP Tips for certification - OdW13
 
Marrow: A Meta-Framework for Python 2.6+ and 3.1+
Marrow: A Meta-Framework for Python 2.6+ and 3.1+Marrow: A Meta-Framework for Python 2.6+ and 3.1+
Marrow: A Meta-Framework for Python 2.6+ and 3.1+
 
PHP7 Presentation
PHP7 PresentationPHP7 Presentation
PHP7 Presentation
 
The new features of PHP 7
The new features of PHP 7The new features of PHP 7
The new features of PHP 7
 
The why and how of moving to PHP 5.4/5.5
The why and how of moving to PHP 5.4/5.5The why and how of moving to PHP 5.4/5.5
The why and how of moving to PHP 5.4/5.5
 
Just-In-Time Compiler in PHP 8
Just-In-Time Compiler in PHP 8Just-In-Time Compiler in PHP 8
Just-In-Time Compiler in PHP 8
 
I, For One, Welcome Our New Perl6 Overlords
I, For One, Welcome Our New Perl6 OverlordsI, For One, Welcome Our New Perl6 Overlords
I, For One, Welcome Our New Perl6 Overlords
 
The why and how of moving to PHP 5.5/5.6
The why and how of moving to PHP 5.5/5.6The why and how of moving to PHP 5.5/5.6
The why and how of moving to PHP 5.5/5.6
 
Key features PHP 5.3 - 5.6
Key features PHP 5.3 - 5.6Key features PHP 5.3 - 5.6
Key features PHP 5.3 - 5.6
 
PHP7 is coming
PHP7 is comingPHP7 is coming
PHP7 is coming
 
How to deploy node to production
How to deploy node to productionHow to deploy node to production
How to deploy node to production
 
IPC2010SE Doctrine2 Enterprise Persistence Layer for PHP
IPC2010SE Doctrine2 Enterprise Persistence Layer for PHPIPC2010SE Doctrine2 Enterprise Persistence Layer for PHP
IPC2010SE Doctrine2 Enterprise Persistence Layer for PHP
 

Similar to Zend Framework Study@Tokyo #2

Unit testing with zend framework PHPBenelux
Unit testing with zend framework PHPBeneluxUnit testing with zend framework PHPBenelux
Unit testing with zend framework PHPBeneluxMichelangelo van Dam
 
Unit testing with zend framework tek11
Unit testing with zend framework tek11Unit testing with zend framework tek11
Unit testing with zend framework tek11Michelangelo van Dam
 
Quality assurance for php projects with PHPStorm
Quality assurance for php projects with PHPStormQuality assurance for php projects with PHPStorm
Quality assurance for php projects with PHPStormMichelangelo van Dam
 
Unit testing after Zend Framework 1.8
Unit testing after Zend Framework 1.8Unit testing after Zend Framework 1.8
Unit testing after Zend Framework 1.8Michelangelo van Dam
 
Bag Of Tricks From Iusethis
Bag Of Tricks From IusethisBag Of Tricks From Iusethis
Bag Of Tricks From IusethisMarcus Ramberg
 
The Zen of Lithium
The Zen of LithiumThe Zen of Lithium
The Zen of LithiumNate Abele
 
Building Testable PHP Applications
Building Testable PHP ApplicationsBuilding Testable PHP Applications
Building Testable PHP Applicationschartjes
 
Quality Assurance for PHP projects - ZendCon 2012
Quality Assurance for PHP projects - ZendCon 2012Quality Assurance for PHP projects - ZendCon 2012
Quality Assurance for PHP projects - ZendCon 2012Michelangelo van Dam
 
Disregard Inputs, Acquire Zend_Form
Disregard Inputs, Acquire Zend_FormDisregard Inputs, Acquire Zend_Form
Disregard Inputs, Acquire Zend_FormDaniel Cousineau
 
Lithium: The Framework for People Who Hate Frameworks
Lithium: The Framework for People Who Hate FrameworksLithium: The Framework for People Who Hate Frameworks
Lithium: The Framework for People Who Hate FrameworksNate Abele
 
Introduction to Zend Framework web services
Introduction to Zend Framework web servicesIntroduction to Zend Framework web services
Introduction to Zend Framework web servicesMichelangelo van Dam
 
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...ZFConf Conference
 
Zend Framework 2 - Basic Components
Zend Framework 2  - Basic ComponentsZend Framework 2  - Basic Components
Zend Framework 2 - Basic ComponentsMateusz Tymek
 
Doctrine For Beginners
Doctrine For BeginnersDoctrine For Beginners
Doctrine For BeginnersJonathan Wage
 
Rich domain model with symfony 2.5 and doctrine 2.5
Rich domain model with symfony 2.5 and doctrine 2.5Rich domain model with symfony 2.5 and doctrine 2.5
Rich domain model with symfony 2.5 and doctrine 2.5Leonardo Proietti
 

Similar to Zend Framework Study@Tokyo #2 (20)

Unit testing zend framework apps
Unit testing zend framework appsUnit testing zend framework apps
Unit testing zend framework apps
 
Unit testing with zend framework PHPBenelux
Unit testing with zend framework PHPBeneluxUnit testing with zend framework PHPBenelux
Unit testing with zend framework PHPBenelux
 
Unit testing with zend framework tek11
Unit testing with zend framework tek11Unit testing with zend framework tek11
Unit testing with zend framework tek11
 
Quality assurance for php projects with PHPStorm
Quality assurance for php projects with PHPStormQuality assurance for php projects with PHPStorm
Quality assurance for php projects with PHPStorm
 
Fatc
FatcFatc
Fatc
 
Unit testing after Zend Framework 1.8
Unit testing after Zend Framework 1.8Unit testing after Zend Framework 1.8
Unit testing after Zend Framework 1.8
 
Bag Of Tricks From Iusethis
Bag Of Tricks From IusethisBag Of Tricks From Iusethis
Bag Of Tricks From Iusethis
 
The Zen of Lithium
The Zen of LithiumThe Zen of Lithium
The Zen of Lithium
 
Building Testable PHP Applications
Building Testable PHP ApplicationsBuilding Testable PHP Applications
Building Testable PHP Applications
 
Quality Assurance for PHP projects - ZendCon 2012
Quality Assurance for PHP projects - ZendCon 2012Quality Assurance for PHP projects - ZendCon 2012
Quality Assurance for PHP projects - ZendCon 2012
 
Framework
FrameworkFramework
Framework
 
Zend framework service
Zend framework serviceZend framework service
Zend framework service
 
Zend framework service
Zend framework serviceZend framework service
Zend framework service
 
Disregard Inputs, Acquire Zend_Form
Disregard Inputs, Acquire Zend_FormDisregard Inputs, Acquire Zend_Form
Disregard Inputs, Acquire Zend_Form
 
Lithium: The Framework for People Who Hate Frameworks
Lithium: The Framework for People Who Hate FrameworksLithium: The Framework for People Who Hate Frameworks
Lithium: The Framework for People Who Hate Frameworks
 
Introduction to Zend Framework web services
Introduction to Zend Framework web servicesIntroduction to Zend Framework web services
Introduction to Zend Framework web services
 
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...
 
Zend Framework 2 - Basic Components
Zend Framework 2  - Basic ComponentsZend Framework 2  - Basic Components
Zend Framework 2 - Basic Components
 
Doctrine For Beginners
Doctrine For BeginnersDoctrine For Beginners
Doctrine For Beginners
 
Rich domain model with symfony 2.5 and doctrine 2.5
Rich domain model with symfony 2.5 and doctrine 2.5Rich domain model with symfony 2.5 and doctrine 2.5
Rich domain model with symfony 2.5 and doctrine 2.5
 

Recently uploaded

Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxAna-Maria Mihalceanu
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Jeffrey Haguewood
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Karmanjay Verma
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfAarwolf Industries LLC
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 

Recently uploaded (20)

Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance Toolbox
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdf
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 

Zend Framework Study@Tokyo #2

  • 3.
  • 4. id:heavenshell (3/6 ) http://d.hatena.ne.jp/heavenshell http://twitter.com/heavenshell http://github.com/heavenshell http://openpear.org/maintainer/heavenshell Java (Cubby ) Python, JavaScript, Vim
  • 5. 2007 ( ) (PEAR::Pager ) → Phwittr Ver1.5 Ver1.8 Zend_Application
  • 6. Zend_Application (2009/10) 1.10
  • 7. Zend_Application (2009/10) 1.10
  • 8. Doctrine Doctrine Doctrine … ←
  • 9.
  • 10. ASP ( ) CRUD cron (JavaScript) API
  • 11. Zend Framework 1.9x http://github.com/heavenshell/gene Zend_Db, Revulo_View_Phtmlc Doctrine Twig Github web-app-theme http://github.com/pilu/web-app-theme
  • 12. app |-- Gene.php |-- config |-- layouts | |-- admin | `-- index |-- locales | `-- ja |-- models | |-- Tables | `-- Tables.php |-- modules | |-- admin | |-- api | `-- index |-- plugins | `-- Gene |-- services `-- views `-- scripts
  • 13. app |-- Gene.php |-- config |-- layouts | |-- admin | `-- index |-- locales | `-- ja |-- models Zend_Db ( Dao) | |-- Tables | `-- Tables.php |-- modules | |-- admin | |-- api | `-- index |-- plugins | `-- Gene |-- services `-- views `-- scripts
  • 14. app |-- Gene.php |-- config |-- layouts | |-- admin | `-- index |-- locales | `-- ja |-- models Zend_Db ( Dao) | |-- Tables | `-- Tables.php |-- modules Zend_Controller | |-- admin | |-- api | `-- index |-- plugins | `-- Gene |-- services `-- views `-- scripts
  • 15. app |-- Gene.php |-- config |-- layouts | |-- admin | `-- index |-- locales | `-- ja |-- models Zend_Db ( Dao) | |-- Tables | `-- Tables.php |-- modules Zend_Controller | |-- admin | |-- api | `-- index |-- plugins | `-- Gene ( ) |-- services `-- views `-- scripts
  • 16. app |-- Gene.php |-- config |-- layouts | |-- admin | `-- index |-- locales | `-- ja |-- models Zend_Db ( Dao) | |-- Tables | `-- Tables.php |-- modules Zend_Controller | |-- admin | |-- api | `-- index |-- plugins | `-- Gene ( ) |-- services `-- views `-- scripts
  • 17. modules application
  • 19.
  • 20.
  • 22. Q4M Openpear::Net_Q4M … Zend_Queue Zend_Queue_Adapter_Q4m
  • 23.
  • 24. 1.7x Zend Framework use-at-will DB, View, Session, Routing, etc
  • 25. 1.8 Zend_Application Dependency Injection noopable 1.7
  • 26. Storefront (http://www.thepopeisdead.com/) Zend_Application zfdebugdoctrine (http://github.com/danceric/zfdebugdoctrine) ZFDebug Doctrine
  • 27. Magento (http://www.magentocommerce.com/) OSS EC Live Commerce (http://www.live-commerce.com/) OSS TomatoCMS (http://tomatocms.com/) OSS CMS
  • 29. Zend_Application_Bootstrap_Bootstrap [application.ini] bootstrap.path = GENE_LIB_PATH "/Bootstrap.php" bootstrap.class = "Gene_Bootstrap" application.ini ↓ ini bootstrap.path = GENE_APP_PATH "/Phwitter.php" application/ bootstrap.class = "Phwittr" Bootstrap.php
  • 30. ( junichiro ) Zend_Db, Doctrine ( Zend_Db) View (ry Zend_Log Zend_Cache
  • 31.
  • 32.
  • 33. Validation Zend_Filter_Input (Zend_Form ) Zend_Translate
  • 34. FW ini Zend_Translate
  • 35. $requests = array('name' => 'hogehogehoge'); $validations = array( 'name' => array( new Zend_Validate_StringLength(1, 10, 'utf-8'), 'messages' => array( 0 => $translate->_('User name should enter less than 100.'), ) ) ); $validator = new Zend_Filter_Input(null, $validation); $valid = $validator->setData($requests)->isValid(); var_dump($input->getInvalid());
  • 36. $requests = array('name' => 'hogehogehoge'); $validations = array( 'name' => array( new Zend_Validate_StringLength(1, 10, 'utf-8'), 'messages' => array( 0 => $translate->_('User name should enter less than 100.'), ) ) ); Zend_Translate $validator = new Zend_Filter_Input(null, $validation); $valid = $validator->setData($requests)->isValid(); var_dump($input->getInvalid());
  • 37. $requests = array('name' => 'hogehogehoge'); $validations = array( 'name' => array( new Zend_Validate_StringLength(1, 10, 'utf-8'), 'messages' => array( 0 => $translate->_('User name should enter less than 100.'), ) ) ); Zend_Translate $validator = new Zend_Filter_Input(null, $validation); $valid = $validator->setData($requests)->isValid(); var_dump($input->getInvalid());
  • 38. $requests = array('name' => 'hogehogehoge'); $validations = array( 'name' => array( new Zend_Validate_StringLength(1, 10, 'utf-8'), 'messages' => array( 0 => $translate->_('User name should enter less than 100.'), ) ) ); Zend_Translate $validator = new Zend_Filter_Input(null, $validation); $valid = $validator->setData($requests)->isValid(); var_dump($input->getInvalid()); array(1) { ["name"]=> array(1) { ["stringLengthTooLong"]=> string(42) " 10 " }
  • 39. $requests = array('name' => 'hogehogehoge'); $validations = array( 'name' => array( new Zend_Validate_StringLength(1, 10, 'utf-8'), 'messages' => array( 0 => $translate->_('User name should enter less than 100.'), ) ) ); Zend_Translate $validator = new Zend_Filter_Input(null, $validation); $valid = $validator->setData($requests)->isValid(); var_dump($input->getInvalid()); array(1) { ["name"]=> array(1) { ["stringLengthTooLong"]=> string(42) " 10 " }
  • 40. $requests = array('email' => 'example@example.c'); $validations = array( 'email' => array( new Zend_Validate_EmailAddress(), 'messages' => array( 0 => $translate->_('Email is invaild.'), ) ) ) ); $validator = new Zend_Filter_Input(null, $validation); $valid = $validator->setData($requests)->isValid(); var_dump($input->getInvalid());
  • 41. $requests = array('email' => 'example@example.c'); $validations = array( 'email' => array( new Zend_Validate_EmailAddress(), 'messages' => array( 0 => $translate->_('Email is invaild.'), ) ) ) ); $validator = new Zend_Filter_Input(null, $validation); $valid = $validator->setData($requests)->isValid(); var_dump($input->getInvalid());
  • 42. array(1) { ["email"]=> array(1) { ["emailAddressInvalidHostname"]=> string(26) " " } }
  • 43. array(1) { ["email"]=> array(1) { ["emailAddressInvalidHostname"]=> string(26) " " } }
  • 44. _ | ∪ __ __ J| _ u ´ || | || | ● | ∪ __ __ J| _ u ´ || | || |
  • 45. array(1) { ["email"]=> array(3) { ["emailAddressInvalidHostname"]=> string(70) "'example.c' is no valid hostname for email address 'example@example.c'" ["hostnameUndecipherableTld"]=> string(68) "'example.c' appears to be a DNS hostname but cannot extract TLD part" ["hostnameLocalNameNotAllowed"]=> string(86) "'example.c' appears to be a local network name but local network names are not allowed" } }
  • 46. :::::: :::::::: ○ ○ |:::::::::::::::::::: __ __ :::: | _ ::::::::: |r -| || | :::::::::::: ` '´ || |
  • 47. :::::: :::::::: ○ ○ |:::::::::::::::::::: __ __ :::: | _ ::::::::: |r -| || | :::::::::::: ` '´ || |
  • 49. Zend_Translate translate Zend_Validate_Abstract Zend_Validate_Abstract::setDefaultTranslator($transla te);
  • 50. 1.9x, 1.10x http://github.com/heavenshell/gene/blob/0.2/app/ locales/ja/validate.ini http://github.com/heavenshell/zf-resources-lang-ja/ blob/master/Zend_Validate.php typo <(_ _)>
  • 51. [Ver1.9x] $locale = new Zend_Locale(); $path = '/path/to/ja/file.ini'; $translate = new Zend_Translate('ini', $path, $locale); Zend_Validate_Abstract::setDefaultTranslator($translate); [Ver1.10x] $locale = new Zend_Locale(); $path = '/path/to/resources/languages'; $scan = array('scan' => Zend_Translate::LOCALE_DIRECTORY); $translate = new Zend_Translate('array', $path, $locale, $scan); Zend_Validate_Abstract::setDefaultTranslator($translate);
  • 52. [Ver1.9x] $locale = new Zend_Locale(); $path = '/path/to/ja/file.ini'; $translate = new Zend_Translate('ini', $path, $locale); Zend_Validate_Abstract::setDefaultTranslator($translate); [Ver1.10x] array() $locale = new Zend_Locale(); $path = '/path/to/resources/languages'; $scan = array('scan' => Zend_Translate::LOCALE_DIRECTORY); $translate = new Zend_Translate('array', $path, $locale, $scan); Zend_Validate_Abstract::setDefaultTranslator($translate);
  • 53. ( )
  • 54.
  • 55.
  • 56. trunk
  • 57. " '%value%' '%hostname%' " Zend_Validate.php Zend_Translate#addTranslation()
  • 58. return array( ''%hostname%' is no valid hostname for email address '%value%'' => ' ///' ); $locale = new Zend_Locale(); $path = '/path/to/resources/languages'; $scan = array('scan' => Zend_Translate::LOCALE_DIRECTORY); $translate = new Zend_Translate('array', $path, $locale, $scan); $anotherpath = '/path/to/resources/languages' . $lang . '/Another.php'; $translate->addTranslation($anotherpath); Zend_Validate_Abstract::setDefaultTranslator($translate); array(3) { ["emailAddressInvalidHostname"]=> string(72) " ///" ["hostnameUndecipherableTld"]=> string(82) "'examlpe.c' DNS TLD " ["hostnameLocalNameNotAllowed"]=> string(126) " 'examle.c' " }
  • 59. return array( ''%hostname%' is no valid hostname for email address '%value%'' => ' ///' ); $locale = new Zend_Locale(); $path = '/path/to/resources/languages'; $scan = array('scan' => Zend_Translate::LOCALE_DIRECTORY); $translate = new Zend_Translate('array', $path, $locale, $scan); $anotherpath = '/path/to/resources/languages' . $lang . '/Another.php'; $translate->addTranslation($anotherpath); Zend_Validate_Abstract::setDefaultTranslator($translate); array(3) { ["emailAddressInvalidHostname"]=> string(72) " ///" ["hostnameUndecipherableTld"]=> string(82) "'examlpe.c' DNS TLD " ["hostnameLocalNameNotAllowed"]=> string(126) " 'examle.c' " }
  • 60. return array( ''%hostname%' is no valid hostname for email address '%value%'' => ' ///' ); $locale = new Zend_Locale(); $path = '/path/to/resources/languages'; $scan = array('scan' => Zend_Translate::LOCALE_DIRECTORY); $translate = new Zend_Translate('array', $path, $locale, $scan); $anotherpath = '/path/to/resources/languages' . $lang . '/Another.php'; $translate->addTranslation($anotherpath); Zend_Validate_Abstract::setDefaultTranslator($translate); array(3) { ["emailAddressInvalidHostname"]=> string(72) " ///" ["hostnameUndecipherableTld"]=> string(82) "'examlpe.c' DNS TLD " ["hostnameLocalNameNotAllowed"]=> string(126) " 'examle.c' " }
  • 61.
  • 62.
  • 63. CRUD → → x( + )x Scafford
  • 66. CRUD → → x( + ) DB FW ( ) …
  • 67. Zend Framework Zend_Application Zend_Translate ( )

Editor's Notes