Pages

Friday 29 June 2012

bootstrap

Bootstrap: In bootstrap you can setting up the database, configuring your view and view helpers, configuring your layouts, registering plugins, registering action helpers, cron job & service srcipt.

/** Include Bootstrap file in public/index.php */

require_once 'Zend/Application.php';

// Create application, bootstrap, and run
$application = new Zend_Application(
    APPLICATION_ENV,
    APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap()
            ->run();


/** Include Bootstrap file in public/index.php */

 /*in application/bootstrap.php */
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap{}

class Zend_Application_Bootstrap_Bootstrap
    extends Zend_Application_Bootstrap_BootstrapAbstract{}


abstract class Zend_Application_Bootstrap_BootstrapAbstract
    implements Zend_Application_Bootstrap_Bootstrapper,
               Zend_Application_Bootstrap_ResourceBootstrapper


How to call a function from bootstrap
$bootstrap->bootstrap(array('foo'));
In bootstrap class there should be function with name of _initFoo()

Design Patern

Design Patern:  It a formal way of documenting a solution to a problem.


Zend Famework mainly use following Patterns.

Singleton Pattern: It is a design pattern that restricts the instantiation of a class to one object.
 
 Example: 
class Database {
  private static $_singleton;
  private $_connection;
  
  private function __construct($host,$user,$pass){
    $this->_connection = mysql_connect($host,$user,$pass);
  }

  public static function getInstance(){
   if (is_null (self::$_singleton)) {
   self::$_singleton = new Database();
   }
  return self::$_singleton;
  }
}

$db = Database::getInstance();
 
 
 
Factory Pattern: In this Pattern we can create an instance of any of one class in-directly from an static function of another class.
example 
$db = Zend_Db::factory( ...options... ); 

Thursday 28 June 2012

components

Zend_Acl

Provides lightweight and flexible access control list (ACL) functionality and privileges management.
Role: It is an object that may request to access the Resource.
Resource: Object which access is controller.
e.g. Driver request to access the car. Here driver is Role & Car is resource.


Zend_Auth

Zend_Auth provides an API for authentication and includes concrete authentication adapters for common use case scenarios, as well as "Identity 2.0" adapters such as OpenID and Microsoft InfoCard.

Zend_Cache

Zend_Cache provides a flexible approach toward caching data, including support for tagging, manipulating, iterating, and removing subsets.

Zend_Config

Zend_Config simplifies the use of configuration data for web applications.

Zend_Console_Getopt

Command-line PHP applications benefit from this convenient object-oriented interface for declaring, parsing, and reporting command-line arguments and options.

Zend_Controller and Zend_View

Controller is for logical part and view is for Html Part.

Zend_Date

Zend_Date offers a detailed but simple API for manipulating dates and times.

Zend_Db

This is a lightweight database access layer, providing an interface to PDO and other database extensions in PHP. It includes adapters for each database driver, a query profiler, and an API to construct most SELECT statements.

Zend_Db_Table

The Zend_Db_Table component is a lightweight solution for object-oriented programming with databases.

Zend_Feed

This component provides a very simple way to work with live syndicated feeds.

Zend_Filter and Zend_Validate

These components encourage the development of secure websites by providing the basic tools necessary for input filtering and validation.

Zend_Filter_Input

This is a configurable solution for declaring and enforcing filtering and validation rules. This component serves as a "cage" for input data, so they are available to your application only after being validated.

Zend_Form

This component provides an object-oriented interface for building forms, complete with input filtering and rendering capabilities.

Zend_Gdata (Zend Google Data Client)

The Google Data APIs provide read/write access to such services hosted at google.com as Spreadsheets, Calendar, Blogger, and CodeSearch.

Zend_Http_Client

This component provides a client for the HTTP protocol, without requiring any PHP extensions. It drives our web services components.

Zend_Json

Easily convert PHP structures into JSON and vice-versa for use in AJAX-enabled applications.

Zend_Layout

Easily provide sitewide layouts for your MVC applications.

Zend_Loader

Load files, classes, and resources dynamically in your PHP application.

Zend_Locale

Zend_Locale is the Framework's answer to the question, "How can the same application be used around the whole world?" This component is the foundation of Zend_Date, Zend_Translate, and others.

Zend_Log

Log data to the console, flat files, or a database. Its no-frills, simple, procedural API reduces the hassle of logging to one line of code and is perfect for cron jobs and error logs.

Zend_Mail and Zend_Mime

Almost every Internet application needs to send email. Zend_Mail, assisted by Zend_Mime, creates email messages and sends them.


Zend_Measure

Using Zend_Measure, you can convert measurements into different units of the same type. They can be added, subtracted, and compared against each other.
  • supports localized handling of measurements and numbers
  • supports converting of measurements and numbers

Zend_Memory

Zend_Memory offers an API for managing data in a limited memory mode. A PHP developer can create a Zend_Memory object to store and access large amounts of data, which would exceed the memory usage limits imposed by some PHP environments.

Zend_Registry

The registry is a container for storing objects and values in the application space. By storing an object or value in the registry, the same object or value is always available throughout your application for the lifetime of the request. This mechanism is often an acceptable alternative to using global variables.

Zend_Rest_Client and Zend_Rest_Server

REST Web Services use service-specific XML formats. These ad-hoc standards mean that the manner for accessing a REST web service is different for each service. REST web services typically use URL parameters (GET data) or path information for requesting data and POST data for sending data.

Zend_Search_Lucene

The Apache Lucene engine is a powerful, feature-rich Java search engine that is flexible about document storage and supports many complex query types. Zend_Search_Lucene is a port of this engine written entirely in PHP 5.


Zend_Service: Akismet, Amazon, Audioscrobbler, Delicious, Flickr, Nirvanix, Simpy, StrikeIron and Yahoo!

Web services are important to the PHP developer creating the next generation of mashups and composite applications. Zend Framework provides wrappers for service APIs from major providers to make it as simple as possible to use those web services from your PHP application.


Zend_Session

Zend_Session helps manage and preserve session data across multiple page requests by the same client.


Zend_Translate

The Zend_Translate component provides Zend Framework with message translation functionality.


Zend_Uri

Zend_Uri is a component that aids in manipulating and validating Uniform Resource Identifiers (URIs). Zend_Uri exists primarily to service other components such as Zend_Http_Client but is also useful as a standalone utility.


Zend_XmlRpc

Zend_XmlRpc makes it easy to communicate with and create XML-RPC services from PHP.
  • mimics PHP's SOAP extension
  • flexible request and response implementation allows for use with non-HTTP services
  • server implementation allows attaching existing classes to quickly expose APIs as XML-RPC services
  •  
More Info..

Wednesday 27 June 2012

Model View Controller Architecture

MVC Diagram
MVC Diagram


 In MVC pattern, we differentiate our logic(controller), Mysql(model) and html(view).

View: It have all the Html parts of the page. Here we use the variables which we have set in controllers.

Model: MYSQL queries parts of the page, we make an object of the model in controller & call the functions of the model. after fetching the data, we set it in controller & use in view.

Controller: It have all the logic part of the site.

Zend Framework Certification Topics

MVC

  • Components
  • Pattern Basics
  • Bootstrap
  • Zend_Controller
  • Zend_Layout

Infrastructure

  • Zend_Config
  • Zend_Session
  • Zend_Registry
  • Zend_Loader

Internationalization

  • Zend_Date
  • Zend_Translate
  • Zend_Locale
  • Zend_Currency
  • Zend_View_Helper_ Translate
  • Internationalization Performance

Authentication and Access

  • Zend_Acl
  • Zend_Auth
  • Zend_Auth Adapters

Performance

  • Zend_Cache
  • Script inclusion
  • Optimization
  • Zend_Memory

Forms

  • Zend_Form
  • Validation/Filtering
  • Decorators
  • Elements
  • Forms
  • Display Groups & Sub Forms
  • Configuration
  • Internationalization

Security

  • Cross Site Request Forgery
  • Secure Authentication
  • Escaping for output
  • Cross Site Scripting
  • Security Best Practices

Diagnosis and Maintainability

  • Zend_Debug
  • Zend_Log

Filtering and Validation

  • Filtering Chains
  • Custom Filters
  • Standard Validation Classes
  • Validator Chains
  • Custom Validators

search

  • Zend_Search_Lucene
  • Indexing
  • Querying
  • Performance

Database

  • Zend_Db
  • Zend_Db_Statement
  • Zend_Db_Table
  • Zend_Db_Profiler
  • Zend_Db_Select
  • Table Data Gateway Pattern
  • Row Data Gateway Pattern

Mail

  • Constructing
  • Storage
  • Message retrieval
  • Storage providers
  • Message sending

Coding Standards

  • Coding conventions
  • Zend_Loader

Web Services

  • XML-RPC Client
  • XML-RPC Server
  • REST Client
  • REST Server
  • Zend_Service Web Services

 

Above topics are for Zend Framework Certification 1.5, that may be  change in future by Zend. Click  to see Latest syllabus.