Professional Documents
Culture Documents
A quick start on
Zend Framework 2
by Enrico Zimuel (enrico@zend.com)
Senior Software Engineer
Zend Framework Core Team
Zend Technologies Ltd
!
th
"ay #$# %erona (&taly)
All rights reserved. Zend Technologies, Inc.
Enrico Zimuel (@ezimuel)
'o(tware Engineer since !!)
*ssembly +,)- C.C//- 0a1a- 2erl- 232
232 Engineer at Zend in the Zend
Framework Core Team
&nternational s4eaker about 232 and
com4uter security to4ics
Co5author o( the italian book
6232 7est 4ractices8 (F*9 edizioni)
Co5(ounder o( the 2:9 Torino
About me
All rights reserved. Zend Technologies, Inc.
ZF2 in a slide
"odule su44ort
;ames4ace
7etter 4er(ormance
All rights reserved. Zend Technologies, Inc.
#eleases
9oal?
betaC on 0une
"ulti4le a44roaches?
ZF5style includeF4ath autoloader
2er5names4ace.4re(i+ autoloading
Class5ma4 autoloading
All rights reserved. Zend Technologies, Inc.
ZF1)*t+le
require_once 'Zend/Loader/StandardAutoloader.php';
$loader = new Zend\Loader\StandardAutoloader(array(
'fallac!_autoloader' =" true#
$$;
$loader%"re&i'ter($;
All rights reserved. Zend Technologies, Inc.
ZF2 *,Pre-i&
require_once 'Zend/Loader/StandardAutoloader.php';
$loader = new Zend\Loader\StandardAutoloader($;
$loader%"re&i'ter(a)e'pace(
'*y'# __+,-__ . '/../lirary/*y'$
%"re&i'ter.refi/(
'0oo_'# __+,-__ . '/../lirary/0oo'$;
$loader%"re&i'ter($;
All rights reserved. Zend Technologies, Inc.
ZF2 Class).a"
return array(
'*y\0oo\1ar' =" __+,-__ . '/0oo/1ar.php'#
$;
require_once 'Zend/Loader/2la''*apAutoloader.php';
$loader = new Zend\Loader\2la''*apAutoloader($;
$loader%"re&i'terAutoload*ap(
__+,-__ . '/../lirary/.cla'')ap.php'$;
$loader%"re&i'ter($;
.cla'')ap.php
All rights reserved. Zend Technologies, Inc.
Classma" (enerator
:sage is tri1ial?
$ cd your/lirary
$ php /path/to/cla'')ap_&enerator.php %w
Class).a"s
show a #C5,CI im4ro1ement
ames"aces,"re-i&es
shows $5J$I im4ro1ement
ote1 2!e new autoloadin( s+stem o- ZF2 !as been "orted to ZF 1.12
All rights reserved. Zend Technologies, Inc.
3e"endenc+
4n5ection
All rights reserved. Zend Technologies, Inc.
Zend63i
*n 70ent is an action.
All rights reserved. Zend Technologies, Inc.
7&am"le
u'e Zend\;<ent*ana&er\;<ent*ana&er;
$e<ent' = new ;<ent*ana&er($;
$e<ent'%"attach('do'# function($e$ 3
$e<ent = $e%"&et(a)e($;
$para)' = $e%"&et.ara)'($;
printf(
'=andled e<ent >?'@# with para)eter' ?''#
$e<ent#
9'on_encode($para)'$
$;
5$;
$para)' = array('foo' =" 'ar'# 'a:' =" 'at'$;
$e<ent'%"tri&&er('do'# null# $para)'$;
All rights reserved. Zend Technologies, Inc.
.;C
All rights reserved. Zend Technologies, Inc.
70ent dri0en arc!itecture
* names4ace
9ithub?
htt4?..4ackages.zend(ramework.com.
2yrus 4ackages?
Pyrus setup
wget http://packages.zendframework.com/pyrus.phar
pyrus.phar .
Install a Zend_<component>
"ain ste4s
ames"ace? ZendFFoo LM ZendBFoo
7&ce"tions? an &nter(ace (or each com4onents-
no more ZendFE+ce4tion
Autoloadin(? D o4tions (one is ZF)
.;C? module- e1ent based- dis4atchable
3?1 new ZendB<b
Form1 new ZendBForm
All rights reserved. Zend Technologies, Inc.
ZF1 mi(ration "rotot+"e
3ow to contribute?
@rite code
3ocumentation
2estin(
Feedbacks,comments
htt4s?..github.com.zend(ramework.z(#
All rights reserved. Zend Technologies, Inc.
Hel"in( out
htt4?..(ramework.zend.com.z(#
htt4?..github.com.zend(ramework
htt4s?..github.com.zend(ramework.Zend'keleton*44lication
!tt"s1,,5oind.in,A3B%
enricoCDend.com