Upload
ritesh
View
223
Download
0
Embed Size (px)
Citation preview
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 1/43
Install ZEND Framework 2 on Your WAMP and XAMPP Server
Posted on 3 Januar! 2"#3 by Masud Alam
I am a php web application developer; I am working on WAMP Server. I found
some diculties to setup !end "ramework #.$ in my localhost. %ou may found
some diculties in installing the &end framework #.$ like me' that(s why I have
written this article' hope you will found )nd this article helpful.
*. +ownload !"# skeleton app from
,it-ub$tt%s&''()t$u*+,om'-end.ramework'ZendSkeletonA%%l),at)on
as a +-)% format
#. $tract
your ZendSkeletonA%%l),at)on/master+-)% )le to your www directory and
/ename the folder as your pro0ect name. In my localhost' it(s -.2,rud.
1. ,o to 0&1wam%1*)n1%$%1%$%+3+ or if you use $ampp 0ust go
to 0&1am%%1%$% and copies the folder path.
2. /ight3click on M 0om%uter inside your start3menu and click Pro%ert)es'
4. 5lick Advan,ed ta* inside System Properties.
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 2/43
6. 5lick 7Env)ronment
4ar)a*les5 8utton and Select 7Pat$9 inside your 7Sstem var)a*les9
Sections. A new window will pop up once again
:. In the lower of the two bo$es search for the variable Pat$ and double3click it
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 3/43
. <eave everything as is and
0ust =>?+ the variable by 9 60&1wam%1*)n1%$%1%$%+3+9 or
760&1am%%1%$%5 @of course ad0ust your $amppwamp directoryB
C. nable your %$%7o%enssl Module "rom your php.ini "ile
*D. -it ok' ok' ok' start a new 08I 9:; and once again check what %$%
/v returns. It should work now.
**. ,o to
your 08I ' change the directory to the pro0ect directory. Write command 7,d
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 4/43
0&1wam%1www1-.2,rud9 or if you use $ampp 7,d 0&1am%%1$tdo,s1-.2,rud9
and press enter
*#. ?ow run
7%$% ,om%oser+%$ar sel./u%date9 in your 08I
*1. After 5ompleting %$%
,om%oser+%$ar sel. u%date now run 7%$% ,om%oser+%$ar )nstall9
>his will take a while to download and generate autoload )les.
In that mean time' setup the virtual host. assuming that virtual host
is -.2,rud+lo,al$ost
*2. Assuming that I(m going to setup a host named -.2,rud+lo,al$ost and my
host )les are in0&1wam%1www1-.2,rud1%u*l),
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 5/43
*. 5lick WAMP icon on Euick launch then Apache 3F httpd.conf to open
apache con)g )le.
#. ,o to bottom of the )le and add following host settings.
G
1
2
3
4
5
6
7
8
9
10
11
<VirtualHost *:80>
ServerName zf2crud.localhostDocumentoot !:"#am$"###"zf2crud"$u%licSet&nv '(()!'+,N-&NV develo$ment<Director/ !:"#am$"###"zf2crud"$u%lic>Director/nde inde.$h$'llo#,verride 'll,rder allo#1den/'llo# from all<Director/><VirtualHost>
And also add this if you already do not have this' this will give access to
the localhost as usual
G
1
2
3
4
5
6
<VirtualHost *:80>
ServerName localhost
Documentoot !:"#am$"###
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 6/43
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 7/43
*1. Hpen the
windows $ost )le. in my case' 0&1WIND<WS1sstem321dr)vers1et, and placeG
1324.0.0.3 zf2crud.localhost
"inally go http&f#crud.localhost to run your &end framework # demo
goodgood verygood
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 8/43
Install !end "ramework # Step byStep Jsing Windows MySis,it
SoftwarePosted on #3 De,em*er! 2"#3 by Masud Alam
Prere=u)s)tes
8efore you get started !end "ramework # Installation' make sure that you have
the following software installed
‹Servers& $ampp or wamp server
‹ MS)s>)t ,it is needed to check out source code from various
github.com repositories
nable your %$%7o%enssl Module "rom your php.ini "ile
Ste% #&
"irst +ownload and Install MySis,it with 0ust ?e$t ?e$tK.?e$t
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 9/43
Ste% 2&
>o install a new !end "ramework #' we will need to download the latest version
of !endSkeletonApplication and set up a virtual host to point to the newly
created !end "ramework pro0ect. >he steps are given as follows
/un %our MySis,it Software
?avigate Server to folder location where you want to set up the new !end
"ramework pro0ect
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 10/43
Write and /un 5ommand in your git window for 5lone the
!endSkeletonApplication app from ,it-ub$ git clone git://github.com/zendframework/ZendSkeletonApplication.git zf2
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 11/43
Ste% 3&
Install dependencies using 5omposer
?avigate &f# folder location where you want install dependency using
5omposer' Write and /un 8elow 5ommand to your ,it
$ cd zf2
Jpdate composer.phar from your &f# folder ' Write 8elow 5ommand to
your ,it Software <b>$ php composer.phar self-update
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 12/43
Install ,om%oser+%$ar .rom our -.2 .older! Wr)te ?elow 0ommand
to our >)t So.tware
$ php composer.phar install
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 13/43
Ste% @&
So now we have the !end "ramework installed. A couple of things to left we will
do it now. As we always add any site I created into my server I customi&e it to v3
host' so that it will works like a real site with write and view protection as likeserver. So we will do it now.
Hpen this )le 5L$amppLapacheLconfLe$traLhttp3vhosts.conf
Add the following lines to the )le' while ensuring you have the )rst line in
there
<VirtualHost *:80>
ServerName zf2
DocumentRoot C:\xampp\htdocs\zf2\public
SetEnv APPLICATION_ENV "development"
<Directory C:\xampp\htdocs\zf2\public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 14/43
Allow from all
</Directory>
</VirtualHost>
And also add this if you already do not have this' this will give access to
the localhost as usual
<VirtualHost *:80>
ServerName localhost
DocumentRoot C:\xampp\htdocs
SetEnv APPLICATION_ENV "development"
<Directory C:\xampp\htdocs>
DirectoryIndex index.php
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 15/43
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
?ow restart the apache by =ampp control panel stop and start again.
"inally Hpen cLwindowsLsystem1#LdriversLetcLhosts and add this line at the last
127.0.0.1 zf2
127.0.0.1 localhost
?ow 0ust open your browser and type http&f# you will see the !"# welcome
screen. ,ood luck
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 16/43
Install !end "ramework # Step by Step Jsing Windows MySis,it Software
,etting Started with !end"ramework # Part3* !end"ramework # Pro0ect StructurePosted on # De,em*er! 2"#3 by Masud Alam
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 17/43
-ello ,uys. >oday I(ll share with you Zend Framework 2 Pro0ect Structure' to
further start creating your applications on this platform. If you do not have the
base !end "ramework running on your local server' Please look at post 7 Install
ZEND Framework 2 on Your WAMP and XAMPP Server 9 or you can follow
this post 9 Install Zend Framework 2 Ste% * Ste% W)t$ W)ndows
MS)s>)t So.tware 7.
<et(s now we describe the !?+ "ramework # "older and will see how they
inNuence in its application.
oot d)re,tor Stru,ture o. t$e ZEND Framework 2 ProBe,t
Accessing the root directory' in addition to the archives of composer and
autoloader' we have the following directories
3 5on)g
3 data
3 module
3 public
3 vendor
?ow we 0ust try to describe the function of each directory in the proposed
organi&ation by !end. See the directories
/ 0onC(& >his directory is now self3e$plained. -ere are settings in the
application as a whole. Within this we have yet another folder' 7autoload9'
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 18/43
where it is suggested that they are global to local )les @developmentB
con)gurations @productionB and. If you use ,it' no )le by default on this folder
that ends with 7. <ocal.php9 will be synchroni&ed in your commits.
/ Data& -ere you can store your )les that are not part of the application code'but others related to the pro0ect' such as diagrams' database dumps' etc K
/ 4endor& dedicated to third3party libraries directory. If you are using the
8ootstrap' 0Ouery' <ibraries for e3mail or otherwise' this is the folder where they
should stay. ?ote the e$istence of the 5omposer and !end already over there K
/ Pu*l),& !end "ramework works with "ront5ontroller' ie everything that you
access' you are accessing via a path only. -ere' and only here' that users of your
application will access. %our images' 5SS and S )les among others should stayhere in this directory. >he organi&ation and distribution of the )les within this
directory is up to you.
/ Module& >he directory where are the modules of your application. >he !end
"ramework' now in its )rst version' aimed to be modular. -owever' due to many
factors @the !end itself and also programmers using the frameworkB' this brick
structure was never put to good use. Starting with version #' !end "ramework
made it clear that it should be implemented by modules within the application'
and this has been respected to the letter. >hen you ask yourself 7 My
application is small, use the ZF will create only one module. Worth I use it? 9>he
short answer would be9 %S 7because with this architecture' if your application
needs e$pand' you will have complete freedom within the same structure to
implement the growth of it. >he ideal Euestion here would be 7 Do not think I
could take advantage of the capailities of ZF, and I will create a simple
application with no intention to e!pand it. "hould I use ZF in this case? 9>hen
yes' the most correct answer would be negative. ?o one should use the
framework 0ust because it e$ists. >he implementation of advanced codes with itbecomes much simpler' but to implement basic things work there is to con)gure
and assemble the structure sometimes does not pay.
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 19/43
>o)n( dee%er )nto ZEND Framework ProBe,t Folder
Well' by now you already have a preview of the initial structure of Zend
Framework 2 . <et(s go into the folder 7module9 at this time. >his is the main
directory of your application. -ere you will get the modules you will
develop. ?ote the e$isting structure here
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 20/43
Were you scared nowG I hope not' why not get worse K hehehe 0ust kidding
personal aew' 0ust to rela$ a bit. >he structure is interpreted to be complicated
at )rst' but we will navigate through it step by step and you will see that it is
well organi&ed.
<et us begin with the folder A%%l),at)on . "olders at this level are modules of
your application.>he module name should be assigned to the directory. "or each
new module' a new directory must be created. Simple as that. +eepen far this
base module available from !end K
Within the Application' we have three main directories 9 con#g 9' 7 src 9 and
7 view 9. Jnderstand each
A%%l),at)on ' ,onC(
-ere are the )les independent con)guration of this module. ?ote that !endworked well this Euestion' since there is a directory above with general settings
for the application' and this which are speci)c settings 7Application9 module.
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 21/43
A%%l),at)on ' sr,
-ere are the codes of your application. ?ote that this directory is inside a new
directory named 7Application9. >his happens because of namespaces. Within one
@ApplicationB module can have multiple namespaces @Application src Application' Application src model' and so on KB. +o not consider this sub3
modules' but a better way to organi&e your code.
Within the Application src Application directory' note the e$istence of
75ontroller9 folder.>here are controllers @oohhhB. At the same level of
75ontroller9 directory would be the 7Model9 directory for )les that deal tables
your database. Hn this basis of !"' for teaching purposes' this was not
implemented.
A%%l),at)on ' v)ew
>he !" works in layers @MQ5 architectureB. -ere in this folder are only )les of
data visuali&ation layer. See that 0ust below 7view9 we have a 7application9
directory. She refers to the 7Application9 namespace within the 7src9 folder. As
soon as the e$ample given above' this level would also have a directory called
7model9.
Inside the 7application9 we have another directory called 7inde$9 and within it a
7inde$.phtml9 )le called. $plaining >he directory 7inde$9 refers to the
controller 7Inde$5ontroller9 @in this case' if we had a contest called
7>este5ontroller9' the directory at this level would be called 7test9B and
7inde$.phtml9 )le refers to the action 7inde$Action 7within the 5ontroller. >he
e$tension 7. Phtml9 is standard in !end "ramework.
At the same level of 7application9 we also have the folders 7error9 and
7layout9. >he )rst is self3e$planatory' own )les to display errors during e$ecution
and also error page not found @2D2B.>he second has the layout of your
application. >he header' footer and everything is defaults on all pages of your
application are de)ned in this )le. >he !end "ramework is very Ne$ible as to
this' as it allows the creation of multiple layouts for each module' and also
allows you to disable the layout in any single part of the application.
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 22/43
$e eart o. t$e Module
>he )le 7Module.php9 then appears to close this structure. It is within the
7Application9 module directory' and has the responsibility to control the module
in Euestion. It works as a 7front controller9 for the module. 8efore you doanything in this module' !end gives 0ust pass by 7Module.php9.
F)n)s$)n(
%eah' I know' it was too much information at once. So looking at the te$t'
although not very e$tensive' it is perceived that there is enough information to
be assimilated there. >his entire te$t was written of me' and unfortunately I
could not )nd reliable sources to be able to base my writing. If you already work
with !end "ramework # and has a diRerent view of some of these directories'please comment below your opinion right there. >he goal is to bring Euality
content to the programmer who wants to work with !"' and only got it to
constructive discussions and e$change of ideas
A big hug to everyone' especially to my dear wife Ayesha' who put up with me
as I write these posts or have new ideas' and always she is the )rst to be
consulted K hehehehe
,ood,ood Qery,ood
,etting Started with !end "ramework # Part3* Pro0ect Structure
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 23/43
>his entry was posted in Zend Framework 2+ by Masud Alam. 8ookmark the %ermal)nk .
,etting Started with !end"ramework # Part3# 5reate a
!end "ramework # ModulePosted on # De,em*er! 2"#3 by Masud Alam
0reate a Module
Well'. >his version made it clear @and practicalB the use of modules. ?ow in this
post I(ll show you how to create a new module' which we(ll call 7-ello9. <et(s
)rst create the con)guration )les of the module' and later we will create two
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 24/43
static pages to e$emplify the MQ5 architecture @without the 7M9 for nowB'
implemented by !end "ramework #.
<et(s ,o K
0reat)n( t$e Stru,ture Module
*. "irst 5reate a new folder called 7ello9 within the directory
7 zf2/module“ . Inside the 7ello7' create 1 folders 7,onC(7' 7sr,9 and
7v)ew7. Also create a )le called 7 Module+%$% 9' and leave it blank for
now.
#. Inside the 7sr,9 folder' create another folder called 7ello9 @5apitali&ed
same' because the namespaceB
1. Inside the Gsr,'ello5 5reate a "older called G0ontroller5 @5apitali&edsame' because the namespaceB' and also
create Gello0ontroller+%$%5 )le within
the Gsr,'ello'0ontroller5 folder.
2. Inside the 7v)ew9 folder' create another folder called 7$ello9 @this
lowercaseB.
4. "inally' create a )le called 7module+,onC(+%$% 9 in the folder 7,onC(7'
blank for now.
?ote that the structure will look like this
"or now these are the directories and )les that need. 5ome to the most
important part of this process >he con)guration of this module.
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 25/43
0onC(ur)n( t$e module
>he )rst step is to ena*le t$e module . In !end "ramework is all e$plicit' so if
we create a module' we con)gure it properly and do not set this module is
active' it will not run. >o activate it' open the )le7 $f%&con#g&application.con#g.php 9and add the module name in this array
there.See
G
*
#
1
2
4
6
:
C
*
D
*
*
*
#
*
1
*
2
*
4
*
<5$h$
return arra/ 6
7odules7 9> arra/ 6
7'$$lication7 1
7Hello7 1 +his line #as added to activate the module
7odule-listener-o$tions7 9> arra/ 6
7odule-$aths7 9> arra/ 6
7. odule7 1
7. Vendor7 1
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 26/43
6
*
:
*
*
C
#
D
#
*
##
#
1
#
2
#
4
#6
#
:
#
#
C
1
D
1
*
7!onfi;-;lo%-$aths7 9> arra/ 6
7!onfi; autoload *.= lo%al1 local=. (h$7 1
?
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 27/43
?ow we will set its internal settings. Hpen G'
-.2'module'ello',onC('module+,onC(+%$%5 )le and add the following
code
G
*
#
1
2
4
6
:
C
*
D
*
*
*
#
*
1
*
2
*
4
*
6
*
:
*
<5$h$
return arra/6
7router7 9> arra/6
7routes7 9> arra/6
7hello7 9> arra/6
7t/$e7 9> 7)iteral71
7o$tions7 9> arra/6
7route7 9> 7hello71
7defaults7 9> arra/6
7controller7 9> 7Hello"!ontroller"Hello71
7action7 9> 7inde71
1
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 28/43
*
C
#
D
#
*
#
#
#
1
#2
#
4
#
6
#
:
#
#
C
1
D
1
*
1
#
1
1
1
1
7ma/-terminate7 9> true1
7child-routes7 9> arra/6
7default7 9> arra/6
7t/$e7 9> 7Se;ment71
7o$tions7 9> arra/6
7route7 9> 7@:actionA71
7constraints7 9> arra/6
7action7 9> 7@aBz'BCA@aBz'BC0B-BA*71
1
1
1
1
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 29/43
2
1
4
1
6
1
:
1
1
C
2D
2
*
2
#
2
1
22
2
4
2
6
2
:
2
2
C
4
D
1
1
1
7controllers7 9> arra/6
7invoEa%les7 9> arra/6
7Hello"!ontroller"Hello7 9> 7Hello"!ontroller"Hello!ontroller71
1
1
7vie#-mana;er7 9> arra/6
7tem$late-$ath-stacE7 9> arra/6
--D-- . 7..vie#71
1
1
?
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 30/43
4
*
4
#
4
1
4
2
4
4
4
6
4
:
4
4
C
6
D
6
*
6
#
6
1
6
2
6
4
6
6
6
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 31/43
:
6
6
C
:
D
:
*
:
#
:1
:
2
:
4
:
6
::
?ow open the "ile 7Module+%$%5 in 7 zf2/module/Hello/ 9and add the
following code
G
*
#
1
2
4
<5$h$
names$ace Hello?
use Cend"vc"oduleoute)istener?
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 32/43
6
:
C
*
D
*
*
*
#
*
1
*
2
*
4
*
6
*:
*
*
C
#
D
#*
#
#
#
use Cend"vc"vc&vent?
class odule
$u%lic function onFootstra$6vc&vent Ge
Geventana;er 9 GeB>;et'$$lication6B>;et&ventana;er6?
Gmoduleoute)istener 9 ne# oduleoute)istener6?
Gmoduleoute)istenerB>attach6Geventana;er?
=
$u%lic function ;et!onfi;6
return include --D-- . 7confi;module.confi;.$h$7?
=
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 33/43
1
#
2
#
4
#
6
#
:
#
#C
1
D
1
*
1
#
11
1
2
1
4
1
6
1
:
1
1
$u%lic function ;et'utoloader!onfi;6
return arra/6
7Cend")oader"Standard'utoloader7 9> arra/6
7names$aces7 9> arra/6
--N'&S('!&-- 9> --D-- . 7src7 . --N'&S('!&--1
1
1
?
=
=
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 34/43
C
2
D
2
*
2
#
2
1
2
2
24
2
6
2
:
2
2C
4
D
4
*
4
#
4
1
Hkay' our module con)guration is set. ?ow let(s create our )rst 5ontroller.
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 35/43
0reat)n( t$e Crst ,ontroller
5reate a )le called 7ello0ontroller+%$% 9 within the
directory 5 zf2/module/Hello/src/Hello/Controller Gand add the following
code
G
*
#
1
2
4
6
:
C
*
D
*
*
*
#
*
1
*
2
*
4
*
6
*
<5$h$
names$ace Hello"!ontroller?
use Cend"vc"!ontroller"'%stract'ction!ontroller?
use Cend"Vie#"odel"Vie#odel?
class Hello!ontroller etends '%stract'ction!ontroller
$u%lic function inde'ction6
Gtet 9 #as set on the controller1 %ut #ill a$$ear in the vie#?
return ne# Vie#odel6arra/6
7eam$le7 9> Gtet1
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 36/43
:
*
*
C
#
D
#
*
#
#
#1
#
2
#
4
#
6
#:
?
=
=
Hnderstand )t l)ne * l)ne&
8)ne 3& de)ne the namespace. As everything is on the )rst folder inside the 7src
9 directory' simply de)ne 7Album L 5ontroller9.
8)ne and & >wo classes that we will use in the controller' so give a 7use9
here.
8)ne & I create a class @must must )nish the class name with 75ontroller9' and
set the name of the )le the same wayB' and I e$tend the same class with !end
responsible for controllers @0ust type the name of the class' since included this in
line 4 of )leB
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 37/43
8)ne #"& "or every action of our controller' a new function must be
de)ned. When followed by the 7Action9 at the end.
8)ne #2& de)ne some string in te$t variable.
8)ne #@ to #& we(re pushing for layer display the string created on line *#.
<et(s see how it will look in the view layerG
0reat)n( t$e v)ew laer
?ow it(s even easier. We have already de)ned everything we needed to make
the system run' 0ust want to see how to print the view layer that string created
there in the controller layer K >hat(s paci)er in honey. 5ome on.
5reate within the directory 7 & $f%&module&'ello&view&hello 7a new directory
called9 $ello 9.>his refers to the folder 0ontroller Gello0ontroller5 . >hat
has to be clear to you' dear reader if we had a controller called
7>este5ontroller9 would create within the directory 7hello9 or directory called
7test9 in lower case letters. ?ow inside the directory 7 /
zf2/module/Hello/view/hello/hello 7' create a )le named9 )le )nde+%$tml 9
In turn' the 7inde$.phtml9 )le references the action 7 )ndeA,t)on 9 within the
controller 5 ello0ontroller G. +id you see how the structure of Zend
Framework 2 is well organi&edG ?ow copy the code below into the
7)nde+%$tml9 )le.
G
*
#
1
2
4
6
<h2> elcome to Hello odule1 7m the action ND&I. <h2>
<JBB +he %elo# line #ill $rint the varia%le G instance BB>
<59 Geam$le 5>
<JBB +his #as defined in the controller Hello!ontroller BB>
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 38/43
:
?ow go into your browser application with J/I 7 ' $ello 7or9 '$ello')nde 9and
see his )rst work with Zend Framework 2 runn)n(
>hat(s it' my friend K >he )rst time we ran this whole process can seem a little
complicated' but practice makes perfect' so train. "ollow this tutorial two or
three times and see that it(s not as complicated as it sounds. ?ote also that we
keep the same layout' so there is no need to con)gure a new one. 8ut you can
de)ne diRerent layouts for modules' including more than one layout per
module. It(s all about setup and con)guration.
0$allen(e& >ry yourself now create a new action' and make it appear on the
screen. If you will try also create a new controller @ do not forget to con#gure the
routes and everything else B and run it. And feel free to also comment on what
you thought of this tutorial.
>hank you for accompanying me on this 0ourney more. Maybe ne$t post I will
show how to work with sEl Eueries to ob0ect3oriented with Zend Framework 2 .
Warmest regards and until ne$t time.
,etting Started with !end "ramework # Part3#3 5reate a !end "ramework #
Module
>his entry was posted in Zend Framework 2+ by Masud Alam. 8ookmark the %ermal)nk .
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 39/43
>ett)n( Started w)t$ Zend
Framework 2 Part/3&0onC(ureNet?eans For ZendFramework 2Posted on Januar! 2"#@ by Masud Alam
>o follow this article please )rst follow this or this articles. In this post you will
have all needed to con)gure ?et8eans : with !end "ramework # basis.
?ow imagine that' having read the post that said' you(re with ?et8eans :
installed and con)gured for our needs. >hen open the ?et8eans : and create anew pro0ect called &f# . See the steps below
*. "irst +ownload your !end Skeleton Application
fromhttpsgithub.com&endframework!endSkeletonApplication and save it in
your any drive
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 40/43
#. ?ow ,o
>o ools/K<%t)ons Menu and Select PP and >eneral >ab And Select %our P-P
Interpretor%$%+ee "/HM 5L$amppLphp
1. ?ow ,o
>o ools /K <%t)ons Menu and Select PP and Zend2 >ab.
2. ?ow Provide or 8rowse Zend Skeleton A%%l),at)on Path to Skeleton input
"ield
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 41/43
4. ?ow
Press A%%l and <L
6. Again 5reate new pro0ect in ?etbeans by ,oing F)le/KNew
ProBe,t and 5lick Net
:. 5hoose the %roBe,t name' PP vers)on and save location
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 42/43
. Select <ocal
Web Server in your un As 5ombo bo$ and Select Pro0ect J/<
"rom $tt%&''-.2 that you already con)gure on this article. ?ow 0l),k NetK
C. ?ow Select
%our !end# P-P Web "ramework and 5lick "inish 8utton
*D. >o test that everything is working' we need to run our application. >o do this
simply press "6 in our pro0ect and see the following output in the browser
8/18/2019 Zend Framwork
http://slidepdf.com/reader/full/zend-framwork 43/43
,ood <uck
,etting Started with !end "ramework # Part31 3 5on)gure ?et8eans : "or !end
"ramework #