際際滷

際際滷Share a Scribd company logo
Zend Framework 2
Svt se zmnil!
舘温沿看馨艶岳艶!
V邸echno je jinak!
5.3
Zend Framework 2.0 (ZFMeetup Praha 3.11.2011)
Zend Framework 2.0 (ZFMeetup Praha 3.11.2011)
ZF 2 beta 1
Coding Standards
ZendLoader
ZendLoader
   Classmap
   PSR-0
   Resource loader
   Autoloader factory
   Vy邸邸鱈 v箪kon oproti ZF1
Dependency Injection
class Person {
  public $db;
  public function __construct($dbConfig) {
    $this->db = new DbAdapter($dbConfig);
  }
}

$person = new Person($dbConfig);
$person->...
class Person {
  public $db;
  public function setDb(DbAdapter $dbAdapter)
  {
    $this->db = $dbAdapter;
  }
}

$person = new Person();
$person->setDb(new DbAdapter($dbConfig));
$person->...
Dependency Injection
貼叩dn辿 intern鱈 z叩vislosti
      snadnj邸鱈 testov叩n鱈
Konec e邸en鱈 jak to tam ped叩m?
     (skon鱈 vt邸inou na Zend_Registry)
istj邸鱈 k坦d
ZendDi
Nap鱈 cel箪m frameworkem
   nap. tah叩n鱈 z叩vislost鱈 do controlleru


Nen鱈 poteba new, sta鱈 settery a ono
se to automagicky napln鱈
ZendMvc
ZendMvc
   Dispatch proces - spol辿h叩 na DI
   ActionController
   RestController
   interface Dispatchable
Moduly
Moduly
 bal鱈ky
 v aplikaci neupravovat ani do nich
  neukl叩dat soubory - snadn箪 upgrade
 .phar, .tar
 merguj鱈 konfiguraci s aplikac鱈
Moduly
 vlastn鱈 autoloading
 bude cli skript na instalaci
 v箪razn jednodu邸邸鱈 sd鱈len鱈
  modules.zendframework.com
View
ZendView
 autoescape
 jin辿 ped叩v叩n鱈 promnn箪ch
 $products m鱈sto $this->products
 bude snaz邸鱈 si vymnit viewko
檎看顎岳看厩叩稼鱈
檎看顎岳看厩叩稼鱈
 norm叩ln鱈 / bin叩rn鱈 strom  v箪kon !
 routuje se na DI alias
      ne na Modul/Controller/Action
 RouteMatch
 interface Dispatchable
Request/Response


Request   Response
Request/Response
 sestaveny pesn podle RFC
 minit鱈dy na jednotliv辿 elementy
  HTTP (Location, ContentType, etc)
 pos鱈laj鱈 se v r叩mci MVC event哲
 Response agreguje v箪sledky
Event Manager
Event Manager
 pes eventy je e邸eno skoro v邸echno
  dispatch, routing, 
 ve邸ker辿 hooky
  dispatch.pre
  dispatch.post
永鉛顎乙庄稼霞/堰艶鉛沿艶姻霞/
永鉛顎乙庄稼霞/堰艶鉛沿艶姻霞/
 sjednocen辿  interface Pluggable
 zjednodu邸en辿 na鱈t叩n鱈 (z pohledu
  programov辿 slo転itosti)
 trochu slo転itj邸鱈 na rozjet鱈 pro v箪voj叩e
  (explicitn se registruj鱈 helpery)
 view helpery - __invoke() - is_callable()
Jak za鱈t?
Jak za鱈t?
 PHP 5.3
 DI
 Tutorial: Getting started with Zend
  Framework 2 (beta1) (by Akrabat)
 Applications skeleton + module
V箪hody
+ m叩te pehled co se dje
+ zmny nejsou tak velk辿 
  komponenty pib箪vaj鱈 postupn
+ m哲転ete nov vci zkusit pou転鱈vat
  je邸t ne転 vyjdou
+ m哲転ete zas叩hnout do v箪voje
Nev箪hody
- cokoli, co udl叩te, se m哲転e rozb鱈t
- mus鱈te koukat do zdroj叩ku
- nen鱈 to na produkn鱈 nasazen鱈
Ide叩ln鱈 as na 沿艶壊岳顎沿!
Nenechte si ujet vlak!
Dkujeme za pozornost!
Martin Hujer
   @MartinHujer




Tom叩邸 Fejfar
   @tomasfejfar

More Related Content

Zend Framework 2.0 (ZFMeetup Praha 3.11.2011)