+ All Categories
Home > Technology > Getting up & running with zend framework

Getting up & running with zend framework

Date post: 18-Nov-2014
Category:
Upload: saidur-rahman
View: 1,392 times
Download: 6 times
Share this document with a friend
Description:
Why should we use Zend framework and how we set up the zend framework
Popular Tags:
34
Getting Up & Running with Zend Framework
Transcript
Page 1: Getting up & running with zend framework

Getting Up & Running with

Zend Framework

Page 2: Getting up & running with zend framework

Agenda

• Overview

• MVC

• Components

• Environment setup

• Your first Zend Framework project

• Resources

• QA

Page 3: Getting up & running with zend framework

• Toolbox

• Blueprint

• Skeleton

What is framework ?

Page 4: Getting up & running with zend framework

Why Zend Framework

•Maintain by PHP Company•Open Source•Flexible Architecture • ZF Certification •Partner with

Page 5: Getting up & running with zend framework

Zend Framework – Architecture

• MVC design pattern

• Front Controller pattern

• Component Based

• Loosely couple

Page 6: Getting up & running with zend framework

Zend Components

Zend_Session

Zend_Validate

Zend_AuthZend_Acl

ZEND_FORM

Page 7: Getting up & running with zend framework

Zend web services – Components

Z

EN

D_F

EE

D

ZE

ND

_GD

ATA

Page 8: Getting up & running with zend framework

Environment Setup

• Requirements

1. PHP 5.x2. Web server with mod_rewrite enabled

Page 9: Getting up & running with zend framework

Environment Setup (Continued…)

• Zend tool setup (Ubuntu way)

; include_path=${include_path} “:/path/to/libzend-framework-php” // uncomment in /etc/php5/conf.d/zend-framework.ini

sudo apt-get install zend-framework

Page 10: Getting up & running with zend framework

Environment Setup (Continued…)

• Zend tool setup (Windows way)

Page 11: Getting up & running with zend framework

Environment Setup (Continued…)

Page 12: Getting up & running with zend framework

Environment Setup (Continued…)

Page 13: Getting up & running with zend framework

Environment Setup (Continued…)

Page 14: Getting up & running with zend framework

Environment Setup (Continued…)

Page 15: Getting up & running with zend framework

Environment Setup (Continued…)

• Zend tool setup verification

zf show versionZend Framework Version:

1.11.10

Page 16: Getting up & running with zend framework

Your first Zend Framework project

zf create project {project-name}

Page 17: Getting up & running with zend framework

Your first Zend Framework project

Page 18: Getting up & running with zend framework

Project structure

Page 19: Getting up & running with zend framework

Create Virtual host

<VirtualHost *:80> ServerName local.sitename.comDocumentRoot /var/www/zf-project/public <Directory "/var/www/zf-project/public">

AllowOverride All </Directory>

</VirtualHost>

Page 20: Getting up & running with zend framework

Tada!

Page 21: Getting up & running with zend framework

Connecting to database

resources.db.adapter = "Pdo_Mysql”resources.db.params.host = ”HostName"resources.db.params.username = ”UserName"resources.db.params.password = ”Password"resources.db.params.dbname = ”DbName"

Page 22: Getting up & running with zend framework

Let’s have a CRUD operation

CreateRetrieveUpdateDelete

Page 23: Getting up & running with zend framework

Controller

zf create controller {name}

Page 24: Getting up & running with zend framework

Controller

<?php

class AlbumController extends Zend_Controller_Action{

public function init(){ /* Initialize action controller here */

}

public function indexAction(){/* Your code goes here */

}}

Page 25: Getting up & running with zend framework

Model

zf create model {model-name}

Page 26: Getting up & running with zend framework

Model

<?php

class Application_Model_Albums extends Zend_Db_Table_Abstract{ protected $_name = 'albums';

public function fName() {/* Your code goes here */

}}

Page 27: Getting up & running with zend framework

Crud operation

$data = array( 'artist' => $artist, 'title' => $title,);

public function addAlbum($data) {$this->insert($data);

}

public function updateAlbum($data, $where) {$this->update($data, $where);

}

public function deleteAlbum($where) {$this->delete($where);

}

$where = array('id = ?' => $id

);

Page 28: Getting up & running with zend framework

Zend Frameworks Gems

1. Google2. Amazon3. Flickr4. Yahoo5. More….

• Web services

Page 29: Getting up & running with zend framework

Zend web service (flickr)

Page 30: Getting up & running with zend framework

Zend web service (flickr)

public function flickrAction(){ $flickr = new Zend_Service_Flickr(’YourAPIKey'); $this->view->results = $flickr->tagSearch('worldcup’);}

Page 31: Getting up & running with zend framework

Zend web service (flickr)

<ul> <?php foreach ($this->results as $result){

$photo = $result->Square; ?> <li><a href="<?php echo $photo->ClickUri ?>">

<img src="<?php echo $photo->uri ?>" alt="image"/>

</a></li>

<?php } ?></ul>

Page 32: Getting up & running with zend framework

Resources

• http://akrabat.com/zend-framework-tutorial/

• http://net.tutsplus.com/tutorials/php/zend-framework-from-scratch/

• http://goo.gl/fQLL6

Page 33: Getting up & running with zend framework

Who we are

Shoriful Islam Ronju@leevio

Saidur Rahman Bijon@somewherein

Page 34: Getting up & running with zend framework

Questions & Answers

Any Question?


Recommended