1) What is Zend Framework?
Zend is an open source, object-oriented web application framework. It is implemented in PHP 5. It was developed in 3 March 2006.
2) What is the use of front controller in Zend?
Zend front controller is used to manage routing and dispatching. It collects all the requests from the server and handles it.
3) What is the use of Bootstrap?
In Zend Framewrk, Bootstrap is a class that is used to setup initialization and configure of the application.
4) What is Zend auth?
Zend auth provides authentication for the user like admin, general etc.
5) What is application.ini file in Zend Framework?
In Zend Framework, application.ini file is used for configuration of application. This file is located into the
application/configs/application.ini location.
6) Does Zend Framework support PHP 4?
No, Zend Framework does support PHP4.
7) When do we need to disable layout in Zend Framework?
In Zend Framework, at the time of calling AJAX to fetch data, we need to disable layout using following steps:
- $this->_helper->layout()->disableLayout();
- $this->_helper->viewRenderer->setNoRender(true);
8) Can we call a model in view?
Yes, we can call a model in view.
9) How can we include CSS and view from the controller in Zend Framework?
In Zend Framework, we can include CSS and view from controller by using following steps:
File: $this->headLink()->appendStylesheet('filename.css');
Controller: $this->view->headLink()->appendStylesheet('filename.css');
And then somewhere in our layout we need to echo our headLink object: headLink();?>
10) How do we set module name, controller name and action name in Zend framework?
In Zend Framework, we can set module, controller and action name by using following code statements:
$request->setModuleName('front');
$request->setControllerName('address');
$request->setActionName('addresslist');
11) What are super global variables in Zend framework?
In Zend framework, following are the global variables that we can use in our application.
$request = $this->getRequest();
$_GET = $request->getParams();
$_POST = $request->getPost();
12) How can we create model file in zend framework?
We can create model file in zend Framework by using following steps:
class Application_Model_Users extends Zend_Db_Table_Abstract {
protected $_name = "users";
protected $_primary = "id";
}
13) What is Front Controller in Zend Framework?
In Zend Framework, front controller are:
- routeStartup: This function is called before Zend_Controller_Front calls on the router to evaluate the request.
- routeShutdown: This function is called after the router finishes routing the request.
- preDispatch: it is called before an action is dispatched by the dispatcher.
- dispatchLoopStartup: It is used before enters of Zend_Controller_Front.
- postDispatch: it is called after an action is dispatched by the dispatcher.
14) What is Zend_Form and its features in Zend Framework?
In Zend Framework, Zend_Form is used to create a HTML form. It provides various components like: input, select, radio, and checkbox etc.
Following are the features of Zend form.
- Filtering and validation
- Ordering
- Element and Form rendering, including escaping
- Element aSnd form grouping
- Element and form-level configuration
15) How can we check whether a form posted or not in Zend framework?
In Zend Framework, we can check whether a form posted or not by using following methods.
$request = $this->getRequest();
$getData = $request->getParams();
$postData = $request->getPost();
$isPost = $request->isPost();
16) How can we get a module name in bootstrap file?
We can get a module name in bootstrap file using following steps:
$request = new Zend_Controller_Request_Http();
$moduleName = $request->getModuleName();
17) What are the components used in Zend Framework?
Zend Framework components are used to call request & response methods by using its sub-classes.
$request = new Zend_Controller_Request_Http()
$response = new Zend_Controller_Response_Http()
18) What are Zend Framework MVC and its component?
MVC stands for model view controller. It is an approach that separates the application logic from the presentation. The MVC component are:
19) What are the components of Zend framework?
Zend framework components are:
- zend-servicemanager
- zend-eventmanager and
- zend-modulemanager.
20) What is service manager registration?
Service manager registration is a set of method that used to register a component. Some important methods are given below:
- Factory method
- Abstract factory method
- Initialize method
- Delegator factory method
21) What are the types of routing in Zend framework?
There are following types of routing in Zend framework:
- Hostname: It is used to match host part of the URI.
- Literal: It is used to match exact URI.
- Method: It is used to match HTTP method of the incoming request.
- Part: It is used to match the part of the URI path segment using custom logic.
- Regex: It is used to match the URI path segment by Regex Pattern.
22) How can we create a table in Zend framework?
In Zend framework, we can create a table by using given code:
use tutetable;
CREATE TABLE book (
id int(11) NOT NULL auto_increment,
author varchar(100) NOT NULL,
title varchar(100) NOT NULL,
PRIMARY KEY (id)
);
23) How can we install json component in Zend framework?
In Zend framework, we can install json component by using composer.
Example:
- composer require zendframework/zend-json
24) What are the types of methods of Cookies class in Zend framework?
In Zend framework, there are various methods of Cookies class that are listed in below table:
Cookies Methods |
Description |
addCookie(uri) |
It is used to add a cookie into the request object of the given URI. |
getCookie(cookieName, $cookieForm) |
It is used to get the cookie, $cookieName available in the given URI |
fromResponse(uri) |
It is used to extract cookies from the response object of the given URI. |
isEmpty() |
It is used to find whether the given Cookie object has any cookie or not. |
reset() |
It is used to clear all the cookies in the given URI. |
25) What are the features of Zend framework?
Zend framework features are:
- Pure object oriented web application framework.
- Advanced MVC implementation.
- Supports multi databases Simple cloud API.
- Session management.
- Data encryption.
- Flexible URI Routing.
26) Which protocol is used to send mail in Zend Framework?
In Zend framework, SMPT protocol is used to send mail.
27) Which command is used to debug PHP application in Zend framework?
In Zend framework, echo and die command is used to debug PHP applications.
28) How to implement exchangeArray in Zend framework?
The following code for implement exchangeArray in Zend framework:
<?php
namespace Employee\Model;
class Employee {
public $id;
public $emp_name;
public $emp_job;
public function exchangeArray($data) {
$this->id = (!empty($data['id'])) ? $data['id'] : null;
$this->emp_name = (!empty($data['emp_name'])) ? $data['emp_name'] : null;
$this->emp_job = (!empty($data['emp_job'])) ? $data['emp_job'] : null;
}
}
29) What is the stable version of Zend framework?
The stable version of zend framework is 3.0.0 and reassessed on 28 june 2016.
30) What are the session components in Zend framework?
In Zend framework, the Session components are given below:
Session Components |
Descriptions |
Zend\Session\Container |
It is used to read and write API session information. |
Zend\Session\SessionManager |
It is used to manage the entire lifecycle of a session. |
Zend\Session\Storage |
It is used to specify the session data will be stored in the memory. |
Zend\Session\SaveHandler |
It is used to store and retrieve the session data into a physical location.. |
Zend\Session\Validator |
It is used to protect session from hijacking. |