Zend Framework Interview Questions and Answers

Zend Framework is an open source web utility framework implemented in PHP 7(BSD licence).It is an object-orientated .The framework is essentially a collection of expert PHP based totally pckages. The framework uses numerous packages by means of the use of Composer as part of its package dependency managers; some of them are PHP unit for testing all programs, Travis C for non-stop Integration Services. It provides to customers a support of the Model View Controller.

ZF is both. Zend Framework provides all the components required for most web applications in a single distribution. But Zend Framework components are also loosely coupled, making it easy to use just a few components in a web application- even alongside other frameworks! Using this use-at-will architecture, we are implementing features commonly found in more monolithic frameworks. In fact, we are currently working on a tooling component for the 1.8 release that will make it simpler to build applications using ZF components, yet will not sacrifice the use-at-will nature of existing ZF components. It’s a testament to the use-at-will architecture of Zend Framework that the tooling component itself can be used standalone.

The basic difference between these objects is the ‘scope’ in which they are valid:

Zend_Registry: request scope

Zend_Session: session scope

Zend_Registry is used to store objects/values for the current request. In short, anything that you commit to Registry in index.php can be accessed from other controllers/actions (because EVERY request is first routed to the index.php bootstrapper via the .htaccess file). Config parameters and db parameters are generally prepared for global use using the Zend_Registry object.

Zend_Session actually uses PHP sessions. Data stored using Zend_Session can be accessed in different/all pages. So, if you want to create a variable named ‘UserRole’ in the /auth/login script and want it to be accessible in /auth/redirect, you would use Zend_Session.

Unlike the view and the controller components, the model component can vary dramatically in responsibilities and data storage from one MVC application to the next. It should represent what your application does in the abstract. The Zend Framework community has not defined a model interface, class, or other formalism because we haven’t identified enough added value to justify limitations on what constitutes a model.

Many PHP applications funnel server requests into a single (or few) PHP source file that sets up the environment and configuration for the application, manages sessions and caching, and invokes the dispatcher for their MVC framework. They can do more, but their main job is to take care of the consistent needs of every page of a web application.

In our Blueprint for PHP Applications, we will have a core bootstrapper that receives all dynamic requests for an application and applies a template for application behavior that we can later extend. It will allow us to later customize the functionality for each unique application.

Zend engine is like a virtual machine and is an open source, and is known for its role in automating the web using PHP. Zend is named after its developers Zeev and Aandi. Its reliability, performance and extensibility has a significant role in increasing the PHP’s popularity. The Zend Engine II is the heart of PHP 5. It is an open source project and freely available under BSD style license.

Zend_Controller_Router_Rewrite is the standard framework router. Routing is the process of taking a URI endpoint (that part of the URI which comes after the base URL) and decomposing it into parameters to determine which module, controller, and action of that controller should receive the request. This values of the module, controller, action and other parameters are packaged into a Zend_Controller_Request_Http object which is then processed by Zend_Controller_Dispatcher_Standard. Routing occurs only once: when the request is initially received and before the first controller is dispatched.

Zend_Controller_Router_Rewrite is designed to allow for mod_rewrite-like functionality using pure PHP structures. It is very loosely based on Ruby on Rails routing and does not require any prior knowledge of webserver URL rewriting. It is designed to work with a single Apache mod_rewrite rule.

The CLA protects all users including individuals, small and medium businesses, and large corporations. By having a CLA in place, we mitigate the risk that companies who claim intellectual property infringement may demand royalties or fees from users of Zend Framework, whether individuals or companies. This is especially important for companies basing their business or products on Zend Framework. The Zend Framework CLA helps to ensure that code and other IP in Zend Framework remains free.

If you are contributing code as an individual- and not as part of your job at a company- you should sign the individual CLA. If you are contributing code as part of your responsibilities as an employee at a company, you should submit a corporate CLA with the names of all co-workers that you foresee contributing to the project.

Extending the art & spirit of PHP, Zend Framework Is based on simplicity, object-oriented best practices, corporate Friendly licensing, and a rigorously tested agile codebase, Zend Framework Is Focused on building more secure, reliable, and modern Web 2.0 applications &web services, and consuming widely available APIs from leading vendors like Google, Amazon, Yahoo. Flickr as well as API providers and cataloguers like Strike iron and ProgrammableWeb.

The only requirement for contributing to Zend Framework is submitting our either our Individual Contributors License Agreement ((LA) or our corporate CLA. Once you have signed the CL you can visit our contributors wiki to get started.

We strongly recommend you read and understand the terms of our New BSD License-style license, under which all parts of Zend Framework are licensed, all contributions inclusive.

Lucene is a high-performance, full-featured text search engine that utilizes an open, binary format for storing search indexes and a standardized query format for querying against the indexes. Lucene was originally written in java as part of the Apache project. Zend_Search_Lucene is a PHP implementation that provides full binary compatibility with Java Lucene.

When you think that you are getting wrong output from Zend_Date then it’s often needed to see what Zend_Date really uses internally.

Well., a var_dump of Zend_Date is not really helpful,l but you could simply use getIso(). This format has all date inform actions

available:

$date- >getIso(); I/could return 2009-10-21 T!5:OO:O2O 1:00’

Note that using toString() and outputting only parts of a date does not show all needed information’s. There could be a wrong used timezone, or a DST change which is suppressed by toString() but shown with getIso().

The receive() method will return true for file elements that are not required. The reason is that you said “the file can be omitted, and that’s ok for me”. The receive() method will return false only in the event of a failure.

Still there are several ways to detect if a file has been uploaded or not:

Use isUploaded which returns a boolean

Use getFileName which returns null in this case (note that you must use the latest release for this behavior)

Use getFileInfo which will have an empty ‘file’ key and the flag ‘isUploaded’ set to false