SlideShare ist ein Scribd-Unternehmen logo
1 von 117
Zend Framework in 2009
Alan Seiden – Strategic Business Systems
alan@alanseiden.com
New York PHP
24-Feb-2009
NY-PHP Zend Framework | 24-Feb-2009 | 2
Speaker
Alan Seiden: alan@alanseiden.com
PHP and Zend Framework Consultant
Strategic Business Systems, Inc.
Contributor: Mantis/400 & IBM’s Zend Core for i5/OS
Writer about PHP for IBM i5 community
Mentor for teams learning Zend Framework
Zend Certified Engineer—Zend Framework
NY-PHP Zend Framework | 24-Feb-2009 | 3
Tonight we will cover:
• Zend Framework (ZF) basics
 What, why, how
• ZF’s flexible model-view-controller (MVC)
implementation
 Keeps your code organized logically and handles “plumbing”
• Components (libraries)
 Including classes to access web services
• What’s new and what’s next
NY-PHP Zend Framework | 24-Feb-2009 | 4
What is ZF?
• An open source, MVC-based PHP framework
• Is it a framework? Yes
 "Glue" to build applications
 Components developed, tested, distributed together
• But loosely coupled
 “Use at will” architecture
 Dependencies documented in manual
• Section A.1.4. Zend Framework Dependencies
NY-PHP Zend Framework | 24-Feb-2009 | 5
Birth and early years
• 2005: PHP Collaboration Project at ZendCon
 Started as collection of components but coalesced
 PHP 5, object oriented (OO) from the start
 Set example of OO design patterns and practices
• July 2007: GA version 1.0
• February 17, 2009: version 1.75
• Frequent minor releases
NY-PHP Zend Framework | 24-Feb-2009 | 6
What’s it made of?
• Robust, high quality object-oriented PHP 5
libraries
 Test-driven development
• 80+% code coverage
 Peer review of all code
 Coding standards
• http://framework.zend.com/manual/en/coding-standard.html
 Components not released until documented in manual and
inline
• phpDocumentor format: http://phpdoc.org
NY-PHP Zend Framework | 24-Feb-2009 | 7
Flexible License
• “New BSD” license
 http://framework.zend.com/license
 Use code however you like
• Apache-like contributor license agreement (CLA)
 Safety for users/corporations
 All original code; no patent claims
NY-PHP Zend Framework | 24-Feb-2009 | 8
Why I use it
• As I learn what it can do, the less boring code I write
 At first, I reinvented the wheel
 Realized that ZF already provided functionality
 I can write less “plumbing” code
• Can customize and extend
 Numerous integration points
 Interfaces and small methods give you control
• It keeps up with trends and APIs
 Compatibility with diverse database systems, authentication and
other APIs
 Including IBM i (AS/400)’s unique version of db2
 Web services
NY-PHP Zend Framework | 24-Feb-2009 | 9
Community
• Contributors include individuals and companies.
Companies include:
 Zend (of course)
 IBM
 OmniTI
• Technology partners:
 Adobe, Google, IBM, Microsoft, nirvanix, StrikeIron
• Help available at zfforum.com, e-mail lists, #zftalk
IRC
NY-PHP Zend Framework | 24-Feb-2009 | 10
Requirements for Zend Framework 1.75
• Required:
 PHP 5.2.4+
• Optional:
 mod_rewrite
• Recommended; route URLs through bootstrap file
 Extensions as needed. Examples:
• ext/session in Zend_Session
• ext/gd in Zend_Captcha
 PHPUnit 3.3.0 if use Zend_TestPHPUnit
• Full list of reqs and dependencies:
 framework.zend.com/manual/en/requirements.html
NY-PHP Zend Framework | 24-Feb-2009 | 11
How it’s developed
NY-PHP Zend Framework | 24-Feb-2009 | 12
Issue tracker
NY-PHP Zend Framework | 24-Feb-2009 | 13
Timesaving conventions
• Autoloader
 PEAR convention for class/file names
• Example: Search_Product = Search/Product.php
• Put this in bootstrap file:
require_once 'Zend/Loader.php';
Zend_Loader::registerAutoload();
• Now you can do:
$prod = new Search_Product();
• Fluent interface
$select = $db->select()
->from( ...specify table and columns... )
->where( ...specify search criteria... )
->order( ...specify sorting criteria... );
NY-PHP Zend Framework | 24-Feb-2009 | 14
Model-View-Model-View-
ControllerController
NY-PHP Zend Framework | 24-Feb-2009 | 15
Model – View – Controller design pattern
• Model
 Classes that access your data
• View
 Templates to present that data (e.g. HTML for browser)
• Controller (action controller)
 Application flow
 Connects model and view
• (Bonus: front controller!)
NY-PHP Zend Framework | 24-Feb-2009 | 16
Front ControllerFront Controller
NY-PHP Zend Framework | 24-Feb-2009 | 17
Front controller pattern
• Front controller sits in front of MVC
• All PHP requests funneled through index.php (bootstrap file)
• Front controller gets your application started
 Initializes request/response objects
 Can handle common settings and functionality
• “Include” paths
• Configurations
• Location of MVC components (if necessary)
• Logging, db (perhaps), authentication/authorization
 Converts URL to a “request” object with distinct parts
 Routes requests to appropriate action controllers
• Receives exceptions
NY-PHP Zend Framework | 24-Feb-2009 | 18
Front controller to action controller
NY-PHP Zend Framework | 24-Feb-2009 | 19
Routes URL request
• Default routing convention:
 http://example.com/controller/action/param1/value1...
Front
Controller
Controller1
action1()
action2()
Controller2
action1()
action2()
Bootstrap:
index.php
http
reques
t
Action maps to
method name
Param/value pairs
are passed to
action
Controller maps
to class name
NY-PHP Zend Framework | 24-Feb-2009 | 20
Front controller needs two files in public folder
In document root
(public folder):
1. .htaccess
redirects requests
to bootstrap script
(index.php)
2. index.php
instantiates
Front Controller
NY-PHP Zend Framework | 24-Feb-2009 | 21
Front controller file #1: .htaccess
RewriteEngine on
# funnel all requests to index.php
# except requests for static resources
RewriteRule !.(js|ico|gif|jpg|png|css)$ index.php
NY-PHP Zend Framework | 24-Feb-2009 | 22
Front controller file #2: index.php
<?php
// bootstrap file
setincludepath('.' . PATHSEPARATOR . '../library' .
PATHSEPARATOR . '../application/default/models/' .
PATHSEPARATOR . getincludepath());
// Prepare the front controller
$frontController = Zend_Controller_Front::getInstance();
// Dispatch the request using the front controller
$frontController->dispatch();
NY-PHP Zend Framework | 24-Feb-2009 | 23
Action ControllerAction Controller
NY-PHP Zend Framework | 24-Feb-2009 | 24
Action Controller
• Controller classes handle groups of request URLs
http://example.com/controller/action
Default: IndexController
 Organizes and groups functionality
 One class (extending Zend_Controller_Action) for each controller
• Action methods in each controller class handle
requests
http://example.com/controller/action
Default: indexAction()
 Named like actionAction()
• Example: If action is “edit” then method is editAction()
NY-PHP Zend Framework | 24-Feb-2009 | 25
More controller functionality
• Several standard methods help organize and
control the flow
 init() – called by the constructor
 preDispatch() – called before the action’s method
 postDispatch() – called after the action’s method
• Utility methods
 forward(), redirect(), getParam(), getRequest(), getResponse(),
render()
• Action helpers add functionality
 Built-in helpers. Example: gotoSimple()
 Your own helpers
 Avoids the need to build your own base controller class
NY-PHP Zend Framework | 24-Feb-2009 | 26
Controller example
NY-PHP Zend Framework | 24-Feb-2009 | 27
Action helpers
• They extend Zend_Controller_Action_Helper_Abstract
• Built-in action helpers
 ActionStack
 AjaxContext
 AutoComplete: Dojo, Scriptaculous
 ContextSwitch
 FlashMessenger
 Json
 Redirector
 Url
 ViewRenderer
• Create your own
 Place in the "My/Helper/" directory of your library (or any directory on your
includepath)
NY-PHP Zend Framework | 24-Feb-2009 | 28
Action helper example: Redirector gotoSimple()
class Forward_Controller extends Zend_Controller_Action
{
protected $redirector = null;
public function init()
{
$this->redirector = $this->helper->getHelper('Redirector');
}
public function myAction()
{
/* do some stuff */
// Redirect to 'my-action' of 'my-controller' in the current
// module, using the params param1 => test and param2 => test2
$this->redirector->gotoSimple('my-action',
'my-controller',
null,
array('param1' => 'test',
'param2' => 'test2'
)
);
}
}
NY-PHP Zend Framework | 24-Feb-2009 | 29
ViewView
NY-PHP Zend Framework | 24-Feb-2009 | 30
View
• Scripts (templates)
 PHP-based script templates to present data
 Should contain only display logic, not business logic
 Default naming: “myaction.phtml”
• Helpers
 Classes and methods that provide reusable view functionality
• Examples of built in view helpers: escape(), formText(), partial(), partialLoop(),
headTitle()
• Write your own, too
• Output filters
• Layout
• Placeholders
NY-PHP Zend Framework | 24-Feb-2009 | 31
Controller (again)…leads to view
NY-PHP Zend Framework | 24-Feb-2009 | 32
View script automatically rendered
NY-PHP Zend Framework | 24-Feb-2009 | 33
Zend_Layout
NY-PHP Zend Framework | 24-Feb-2009 | 34
Zend_Layout
• Two-step view pattern
 Uses Zend_View for rendering
• Placeholders useful for setting javascript, titles, other variable data
• Layout view helper
 shortcut to layout placeholder
 These are equivalent:
// fetch 'content' key using layout helper:
echo $this->layout()->content;
// fetch ‘content' key using placeholder helper:
echo $this->placeholder('Zend_Layout')->content;
• Enable in bootstrap
   // accept default path
Zend_Layout::startMvc();
   // or specify path
   $layoutPath = realpath(dirname(__FILE__) .            
'/../application/layouts');
   Zend_Layout::startMvc(array("layoutPath“ => $layoutPath));
NY-PHP Zend Framework | 24-Feb-2009 | 35
My own view helper: TitleCase.php
<?php
Require_once 'Zend/View/Interface.php';
/**
 * TitleCase helper
*/
class Zend_View_Helper_Title_Case {
public $view;
public function titleCase($string = '') 
{
    // convert incoming string so that
    // first letter of each word is capitalized/
    // but all other letters are lowercase.
    // Also trim the string.
    return ucwords(strtolower(trim($string)));
} //(public function titleCase())
public function setView(Zend_View_Interface $view) {
$this->view = $view;
}
}
Usage:
echo $this->titleCase(‘mozilla 
firefox’);
// Mozilla Firefox
NY-PHP Zend Framework | 24-Feb-2009 | 36
ModelModel
NY-PHP Zend Framework | 24-Feb-2009 | 37
Model
• Models are abstract representations of data
 Can be extended from:
• Zend_Db_Table_Row – For database abstraction
• Zend_Feed_Element – For RSS abstraction
• Yahoo_Result – For Yahoo abstraction
• Or any other class that fits your needs
• Or build your own own abstract representations of your data
NY-PHP Zend Framework | 24-Feb-2009 | 38
Models (more)
• Model classes contain business logic to prepare
complex data for presentation
• I stuff any “weird” code in models so that
controllers/views are clean
NY-PHP Zend Framework | 24-Feb-2009 | 39
Model: example
<?php
// model: Busyflag.php
class Busyflag
{
    // The table name 
    protected $name = ‘SYSFLAGS'; // old-fashioned “System 36” table
    // isSiteUp: return true if up, false if down
    public function isSiteUp() {
        // one record, with key "B"    
        $sql = "select BZYFLG from {$this->name} where RECID = 'B'"; 
        $row = SBSDbhelp::getOneRow($sql); 
        // true if Y, false otherwise.
        return $row['BZYFLG'] == 'Y'; 
    } //(public function isSiteUp())
} //(class Busyflag)
// usage (from a preDispatch front controller plugin)
$busyFlag = new Busyflag();
if (!$busyFlag->isSiteUp()) {
    // Take user to "site down" page.
    $request->setControllerName("Down");
    $request->setActionName("index");
} //(if (!$busyFlag->isSiteUp()))
NY-PHP Zend Framework | 24-Feb-2009 | 40
Controller + Model + View: traditional
<?php
// Controllers/SearchController.php
require_once 'Zend/Controller/Action.php';
class SearchController extends Zend_Controller_Action 
{
public function indexAction() 
    {
        $prodid = $this->_getParam('prodid');
        
        // look up product data in model
        $products = new Search_Products();
        $results = $products->find($prodid);
        
        // assign results to view
     $this->view->results = $results; 
    }
}
<?php
// views/scripts/search/index.phtml
?>
Products found:<ul>
<?php
foreach ($this->results as $result) {
    echo "<li>{$this->escape($result->prodname)}</b>{$this->escape($result-
>available)}</li>";
}                        
?>
</ul>
NY-PHP Zend Framework | 24-Feb-2009 | 41
MVC your way: custom routing rules
• Can declare custom routing rules with
Zend_Controller_Router_Route classes
 Not limited to “controller/action/param” format
 Example: “year/month/day/title” as in a blog
posting:
 URL: http://myblog.com/2008/02/24/i-like-routers
 $route = new Zend_Controller_Router_Route(
    ':year/:month/:day/:title',
    array(
        'year'       => 2009,
        'controller' => ‘articles',
        'action'     => 'show'
    ),
    array(
           'year'  => 'd+‘,
           ‘month' => 'd+‘,
           ‘day‘   => 'd+‘,
       )
);
$router->addRoute(‘posts', $route);
NY-PHP Zend Framework | 24-Feb-2009 | 42
MVC your way: multi-MVC
• Can separate app sections into modules
(Mitch P.’s “atomic MVC”)
$front->setControllerDirectory(array(
'default' => '/demo/application/controllers',
'blog' => '/demo/application/blog/controllers' ));
• Blog_IndexController is class name of index
action controller within blog app/module
 URL: example.com/blog or /blog/index or
/blog/index/index
• IndexController is still class name within
default app/module
 URL: / or /index or /index/index
NY-PHP Zend Framework | 24-Feb-2009 | 43
Tools can help get you started
• Zend Studio for Eclipse creates default directory structures and
classes for you
 Free trial: http://www.zend.com/en/products/studio/
NY-PHP Zend Framework | 24-Feb-2009 | 44
ComponentsComponents
NY-PHP Zend Framework | 24-Feb-2009 | 45
Library of Zend components
Reminder:
Zend/Db.php = Zend_Db
Zend/Db/Table.php = Zend_Db_Table
NY-PHP Zend Framework | 24-Feb-2009 | 46
Components vs. straight PHP
• Additional functionality
 Zend_Session vs. straight $_SESSION
 Zend_Debug::dump() vs. vardump
• Thread-safety
 Zend_Translate vs. gettext
 Zend_Locale vs. setlocale
• OO
 OO Syntax
 May be extended with custom functionality
 ZF components reduce coding when used together
• They’ve been tested and integrated for you
NY-PHP Zend Framework | 24-Feb-2009 | 47
Components in 1.75
Zend_Acl
Zend_Amf
Zend_Auth
Zend_Cache
Zend_Captcha
Zend_Config
Zend_Config_Writer
Zend_Console_Getopt
Zend_Controller
Zend_Currency
Zend_Date
Zend_Db
Zend_Debug
Zend_Dojo
Zend_Dom
Zend_Exception
Zend_Feed
Zend_File
Zend_Filter
Zend_FilterInput
Zend_Form
Zend_Gdata
Zend_Http
Zend_Infocard
Zend_Json
Zend_Layout
Zend_Ldap
Zend_Loader
Zend_Locale
Zend_Log
Zend_Mail
Zend_Measure
Zend_Memory
Zend_Mime
Zend_OpenId
Zend_Paginator
Zend_Pdf
Zend_ProgressBar
Zend_Registry
Zend_Rest
Zend_Search_Lucene
Zend_Server_Reflection
Zend_Akismet
Zend_Amazon
Zend_Audioscrobbler
Zend_Delicious
Zend_Flickr
Zend_Nirvanix
Zend_ReCaptcha
Zend_Simpy
Zend_SlideShare
Zend_StrikeIron
Zend_Technorati
Zend_Twitter
Zend_Yahoo
Zend_Session
Zend_Soap
Zend_Test
Zend_Text
Zend_Timesync
Zend_Translate
Zend_Uri
Zend_Validate
Zend_Version
Zend_View
Zend_Wildfire
Zend_XmlRpc
Zend_XConsoleProcessUnix
Zend_XJQuery
NY-PHP Zend Framework | 24-Feb-2009 | 48
Component categories
• MVC
• Formatting
• Ajax
• Identity, Authentication, and Authorization
• Forms
• Datastore
• Web Services
• Enterprise
• Debugging, Logging, and Testing
• I18n and L10n
• Mail
• Infrastructure
NY-PHP Zend Framework | 24-Feb-2009 | 49
MVC components (you already know these)
• Zend_Controller
• Zend_Layout
• Zend_View
NY-PHP Zend Framework | 24-Feb-2009 | 50
Formatting
• Zend_Text
• Zend_Paginator
NY-PHP Zend Framework | 24-Feb-2009 | 51
Ajax
• Zend_Dojo
• Zend_Json
NY-PHP Zend Framework | 24-Feb-2009 | 52
Identity, authentication, and authorization
• Zend_Acl
• Zend_Auth
• Zend_Infocard
• Zend_OpenId
• Zend_Session
NY-PHP Zend Framework | 24-Feb-2009 | 53
Form and input validation
• Zend_Captcha
• Zend_Form
• Zend_Validate
• Zend_Filter
NY-PHP Zend Framework | 24-Feb-2009 | 54
Database access
• Zend_Db
• Zend_Db_Table
• Zend_Db_Profiler
NY-PHP Zend Framework | 24-Feb-2009 | 55
Web services
• Zend_Feed
• Zend_Gdata
• Zend_Http
• Zend_Rest
• Zend_Server_Reflection
• Zend_Soap
• Zend_Uri
• Zend_XmlRpc
NY-PHP Zend Framework | 24-Feb-2009 | 56
Zend_Service_* clients
• Akismet
• Amazon
• Audioscrobbler
• Delicious
• Flickr
• Nirvanix
• ReCaptcha
• Simpy
• SlideShare
• StrikeIron
• Technorati
• Twitter
• Yahoo
NY-PHP Zend Framework | 24-Feb-2009 | 57
Additional categories
• Zend_Ldap
• Zend_Search_Lucene
• Zend_Pdf
NY-PHP Zend Framework | 24-Feb-2009 | 58
Debugging, logging, and testing
• Zend_Debug
• Zend_Log
• Zend_Test
• Zend_Wildfire
NY-PHP Zend Framework | 24-Feb-2009 | 59
I18n and L10n
• Zend_Currency
• Zend_Calendar
• Zend_Date
• Zend_Locale
• Zend_Measure
• Zend_TimeSync
• Zend_Translate
NY-PHP Zend Framework | 24-Feb-2009 | 60
Mail
• Zend_Mail
• Zend_Mime
NY-PHP Zend Framework | 24-Feb-2009 | 61
Infrastructure
• Zend_Cache
• Zend_Config
• Zend_Console
• Zend_File
• Zend_Loader
• Zend_Memory
• Zend_Registry
• Zend_Version
NY-PHP Zend Framework | 24-Feb-2009 | 62
RegistryRegistry
NY-PHP Zend Framework | 24-Feb-2009 | 63
Registry
• Store global data without polluting the global
scope
 Zend_Registry::set(‘key’, $value);
 Zend_Registry::get(‘key’);
 Useful for storing sessions, configuration data or any data that
could potentially be important on a per-request basis
NY-PHP Zend Framework | 24-Feb-2009 | 64
LoggingLogging
NY-PHP Zend Framework | 24-Feb-2009 | 65
Logging
• Structured, flexible logging class
• Zend_Log has several backends
 Stream (write to a file)
 Firebug
 Mail
 Db
• Example of logging to file system
$writer = new Zend_Log_Writer_Stream('/path/to/logfile');
// Only email warning level entries and higher.
$writer->addFilter(Zend_Log::WARN);
$logger = new Zend_Log($writer);
// later…
$logger->info('Informational message');
$logger->err(‘Error message');
// “Error message”
NY-PHP Zend Framework | 24-Feb-2009 | 66
Logging: Firebug backend
• Zend_Log_Writer_Firebug, Zend_Db_Profiler_Firebug
• Install Firebug and FirePHP in Firefox
// in bootstrap
$logger = new Zend_Log();
$writer = new Zend_Log_Writer_Firebug();
$logger->addWriter($writer);
Zend_Registry::set('logger',$logger);
// in action controller or anywhere
$logger = Zend_Registry::get('logger');
$logger->log(‘Log message', Zend_Log::DEBUG);
$logger->log(‘Info message', Zend_Log::INFO);
$logger->log(‘Warn message', Zend_Log::WARN);
$logger->log(‘Error message', Zend_Log::ERR);
NY-PHP Zend Framework | 24-Feb-2009 | 67
ConfigConfig
NY-PHP Zend Framework | 24-Feb-2009 | 68
Zend_Config
• OO syntax for reading/writing config files
• Internally it’s an array
• Multiple backends
 INI
 XML
• Divide sections with [ ], good for dev/prod
 And hierarchichy with periods after that
• db.params.username = xxxx
• Many components accept Zend_Config object as well as array
 Db
 Forms
NY-PHP Zend Framework | 24-Feb-2009 | 69
Config + Registry
Config.ini:
[dev]
db.adapter = PDO_MYSQL
db.params.username = admin
db.params.password = xxxx
db.params.dbname = appdb
db.params.host = 192.168.9.1
log.filename = /appdev/logs/app.log
$config = new Zend_Config_Ini(realpath(dirname(__FILE__) .
'/../application/config.ini'), 'dev');
$registry = Zend_Registry::getInstance();
$registry->set('config', $config);
$db = Zend_Db::factory($config->db);
Zend_Db_Table::setDefaultAdapter($db);
$registry->set('db', $db);
// create logger; store it in registry
$logFile = $registry->get('config')->log->filename;
$writer = new Zend_Log_Writer_Stream($logFile);
$logger = new Zend_Log($writer);
$registry->set('logger', $logger);
NY-PHP Zend Framework | 24-Feb-2009 | 70
SessionsSessions
NY-PHP Zend Framework | 24-Feb-2009 | 71
Sessions
• Zend_Session does more than PHP’s ext/session
 Namespaces let multiple applications (or sections of application) run in the
same $_SESSION without risking key name collision
 Used by Zend_Auth by default
 Can set data to expire based on time or clicks/requests
$s = new Zend_Session_Namespace(‘myNamespace');
$s->a = 'apple';
$s->p = 'pear';
$s->o = 'orange';
$s->setExpirationSeconds(5, 'a'); // expire only the key "a" in
5 seconds
// expire entire namespace in 5 "hops"
$s->setExpirationHops(5);
$s->setExpirationSeconds(60);
// The "expireAll" namespace will be marked "expired" on
// the first request received after 60 seconds have elapsed,
// or in 5 hops, whichever happens first.
NY-PHP Zend Framework | 24-Feb-2009 | 72
AuthenticationAuthentication
NY-PHP Zend Framework | 24-Feb-2009 | 73
Authentication
• Built over an adapter that implements
Zend_Auth_Adapter_Interface
 Must have an authenticate() method that returns a
Zend_Auth_Result object
• Several pre-defined adapter classes can
authenticate against common data stores
 Zend_Auth_Adapter_Db_Table, Digest, Http, Ldap, Openid
• Zend_Auth_Storage_Session uses a session
namespace of "Zend_Auth" by default
NY-PHP Zend Framework | 24-Feb-2009 | 74
Authentication example
// created db adapter earlier
$dbAdapter=Zend_Registry::get('db');
$authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter);
$authAdapter
->setTableName('users')
->setIdentityColumn('username')
->setCredentialColumn('password')
;
// Perform the authentication query, saving the result in $_SESSION
$result = $authAdapter->authenticate();
if($result->isValid) {
echo ‘logged in’;
} else {
echo ‘failed’;
}
// Print the result row
print_r($authAdapter->getResultRowObject());
/* Output:
my_username
Array
(
[id] => 1
[username] => my_username
[password] => my_password
[real_name] => My Real Name
)
*/
NY-PHP Zend Framework | 24-Feb-2009 | 75
AuthorizationAuthorization
NY-PHP Zend Framework | 24-Feb-2009 | 76
Authorization
• Classes used
 Zend_Acl_Role
 Zend_Acl_Resource
• Three concepts
 Role
• Assigns particular groups of access to an individual
 Resource
• An object to which access is controlled
• Resources can have privileges (e.g., "create", "read", "update", "delete")
 Access Control List (ACL)
• A hierarchical list that connects role/resource permissions
NY-PHP Zend Framework | 24-Feb-2009 | 77
Authorization
$acl = new Zend_Acl();
$acl->addRole(new Zend_Acl_Role('guest'))
->addRole(new Zend_Acl_Role('member'))
->addRole(new Zend_Acl_Role('admin'));
$parents = array('guest', 'member', 'admin');
$acl->addRole(new Zend_Acl_Role('someUser'), $parents);
$acl->add(new Zend_Acl_Resource('someResource'));
$acl->deny('guest', 'someResource');
$acl->allow('member', 'someResource');
echo $acl->isAllowed('someUser', 'someResource') ?
'allowed' : 'denied';
NY-PHP Zend Framework | 24-Feb-2009 | 78
FormsForms
NY-PHP Zend Framework | 24-Feb-2009 | 79
Zend_Form
• Flexible solution for building forms
• Create in code
 Put it in a model class
• Or create in config file
• Factory pattern lets you determine element type at runtime
• Pass $form to view script, where it’s output
 echo $form; or
 echo $form->ordernum; or
 echo $form->getElement(‘ordernum’);
• Decorators
NY-PHP Zend Framework | 24-Feb-2009 | 80
Zend_Form example
class My_Form extends Zend_Form
{
$form->addElement('text', 'username', array(
'validators' => array(
'alnum',
array('regex', false, '/^[a-z]/i')
),
'required' => true,
'filters' => array('StringToLower'),
));
}
// in your controller…
$form = new My_Form();
$this->view = $form
// in your view…
cho $this->form;
NY-PHP Zend Framework | 24-Feb-2009 | 81
AJAX/DojoAJAX/Dojo
NY-PHP Zend Framework | 24-Feb-2009 | 82
Dojo Integration
Since May 2008
Integration points:
• JSON-RPC Server
• dojo.data Envelopes
• Dojo View Helper
• Dijit integration with Zend_Form & Zend_View
• Dojo Library Re-distribution
• Also JQuery in extras folder
+
NY-PHP Zend Framework | 24-Feb-2009 | 83
Zend_Dojo_Form
class My_Form extends Zend_Dojo_Form
{
protected $_selectOptions = array(
'red' => 'Rouge',
'blue' => 'Bleu',
'white' => 'Blanc',
'orange' => 'Orange',
'black' => 'Noir',
'green' => 'Vert',
);
$this->addElement(
'FilteringSelect',
'filterselect',
array(
'label' => 'FilteringSelect (select)',
'value' => 'blue',
'autocomplete' => false,
'multiOptions' => $this->_selectOptions,
)
)
}
NY-PHP Zend Framework | 24-Feb-2009 | 84
DatabasesDatabases
NY-PHP Zend Framework | 24-Feb-2009 | 85
Databases
• Adapters for various database drivers
 IBM DB2/informix (PDO)
 IBM DB2 and DB2/i5 (IBM i) (non-PDO)
 Firebird/Interbase (non-PDO)
 MS SQL (PDO)
 MySQL (PDO) and MySQLi (non-PDO)
 Oracle (PDO and non-PDO)
 PostgreSQL (PDO)
 SQLite (PDO)
 or build your own by extending Zend_Db_Adapter_Abstract
NY-PHP Zend Framework | 24-Feb-2009 | 86
Databases: connect
$db = new
Zend_Db_Adapter_Pdo_Mysql(array(
'host' => '127.0.0.1',
'username' => 'webuser',
'password' => 'xxxxxxxx',
'dbname' => 'test'
));
NY-PHP Zend Framework | 24-Feb-2009 | 87
Databases
• Several classes give you a good start
 Zend_Db_Adapter_Abstract
• Abstract class for all adapters
• You will most likely use this or concrete implementations
(such as Zend_Db_Adapter_Pdo_Mysql) for your
database access
 Zend_Db_Table
• Gateway class for doing queries on a given table
 Zend_Db_Table_Row
• An instance of a given row
 Zend_Db_Statement
NY-PHP Zend Framework | 24-Feb-2009 | 88
Zend_Db examples
// Using "select" method to select and display
records
$rows = $db->select()->from('CUSTOMERS')
->where('CUSTNO >= 0');
// or write your own SQL with parameters
$sql = 'SELECT * FROM CUSTOMERS WHERE CUSTNO > ? and
CUSTNO < ?';
$rows = $db->fetchAll($sql, array(100, 2000));
// either way, output results
foreach ($rows as $row) {
echo $row['CUSTNO'] . ' ' . $row['CUSTNAME'];
}
NY-PHP Zend Framework | 24-Feb-2009 | 89
Zend_Db_Table example
class Orders extends Zend_Db_Table_Abstract
{
protected $_name = ‘orders';
}
// instantiating your class
$db = Zend_Db::factory('PDO_MYSQL', $options);
// don’t need to specify db if used setDefaultAdapter method earlier
// Zend_Db_Table_Abstract::setDefaultAdapter($db);
$table = new Orders(array('db' => $db));
$data = array(
‘custid' => ‘12345',
‘custname' => ‘Irving Jones’,
);
$table->insert($data);
NY-PHP Zend Framework | 24-Feb-2009 | 90
CachingCaching
NY-PHP Zend Framework | 24-Feb-2009 | 91
Caching
• Frontend
 Core
 Output
 Function
 File
 Class
• Backend
 Apc
 File
 Memcached
 Sqlite
 ZendPlatform
NY-PHP Zend Framework | 24-Feb-2009 | 92
Caching
$frontendOptions = array(
'lifetime' => 7200
);
$backendOptions = array(
'cache_dir' => '../application/cache/'
);
$cache = Zend_Cache::factory(‘Output’, ‘File’,
$frontendOptions, $backendOptions);
if (!($cache->start(‘name-of-cached-item’)) {
// produce output
$cache->end();
}
NY-PHP Zend Framework | 24-Feb-2009 | 93
Unit TestsUnit Tests
NY-PHP Zend Framework | 24-Feb-2009 | 94
Zend_Test_PHPUnit
• Extend Zend_Test_PHPUnit_ControllerTestCase
class User_Controller_Test extends Zend_Test_PHPUnit_ControllerTestCase
{
// ...
public function testCallWithoutActionShouldPullFromIndexAction()
{
$this->dispatch('/user');
$this->assertController('user');
$this->assertAction('index');
}
public function testLoginFormShouldContainLoginAndRegistrationForms()
{
$this->dispatch('/user');
$this->assertQueryCount('form', 2);
}
}
NY-PHP Zend Framework | 24-Feb-2009 | 95
More testing examples
• Valid response codes and login
NY-PHP Zend Framework | 24-Feb-2009 | 96
ValidationValidation
NY-PHP Zend Framework | 24-Feb-2009 | 97
Validation
• Uses the Zend_Validate* classes
$check = new Zend_Validate_Alnum();
if ($check->isValid($GET[‘data’])) {
// do stuff
}
• Each class extends the Zend_Validate_Interface
interface
 You can use the internal validation classes or build your own
NY-PHP Zend Framework | 24-Feb-2009 | 98
Validation
• Pre-defined classes
Alnum
Alpha
Between
Ccnum
Date
Digits
EmailAddress
Float
GreaterThan
Hex
Hostname
InArray
Int
Ip
LessThan
NotEmpty
Regex
StringLength
NY-PHP Zend Framework | 24-Feb-2009 | 99
Web ServicesWeb Services
NY-PHP Zend Framework | 24-Feb-2009 | 100
Client for web services
• Interfaces into web service providers
 Example: Google data
Calendar
Docs
Exif
Feed
Gapps
Gbase
Geo
Media
Photos
Query
Spreadsheets
YouTube
NY-PHP Zend Framework | 24-Feb-2009 | 101
Client classes for web services
• Akismet
• Amazon
• Audioscrobbler
• Delicious
• Flickr
• Nirvanix
• ReCaptcha
• Simpy
• SlideShare
• StrikeIron
• Technorati
• Twitter
• Yahoo
NY-PHP Zend Framework | 24-Feb-2009 | 102
Zend_Service_Yahoo
• Search the web with Yahoo
 Get your application ID from
http://developer.yahoo.com/wsregapp/
 Class uses Zend_Rest_Client under the covers
 Returns Zend_Service_Yahoo_WebResultSet containing
instances of Zend_Service_Yahoo_WebResult
$yahoo = new Zend_Service_Yahoo("YAHOO_APPLICATION_ID");
$results = $yahoo->webSearch('IBM PHP',
array('results' => ‘10',
'start' => 1));
foreach ($results as $result) {
echo '<b>' . $result->Title . '</b> ' . $result->Url . '<br />';
}
NY-PHP Zend Framework | 24-Feb-2009 | 103
Results from $yahoo->webSearch
NY-PHP Zend Framework | 24-Feb-2009 | 104
Other Yahoo search methods
• $yahoo->imageSearch
• $yahoo->videoSearch
• $yahoo->localSearch
• $yahoo->newsSearch
NY-PHP Zend Framework | 24-Feb-2009 | 105
News FeedsNews Feeds
NY-PHP Zend Framework | 24-Feb-2009 | 106
Importing news feeds
• Usage
$feed = Zend_Feed::import($url);
 Returns an instance of Zend_Feed_Abstract
• Implements the Iterator interface
• Understands
 RSS 1.0
 RSS 2.0
 Atom
NY-PHP Zend Framework | 24-Feb-2009 | 107
What’s New?What’s New?
NY-PHP Zend Framework | 24-Feb-2009 | 108
New in ZF 1.7x
• Just a few of the enhancements:
 Performance enhancements in Zend_Loader,
Zend_Controller, and server components
 Zend_Amf component
 Dojo Toolkit 1.2.1
 ZendX_JQuery component
 Zend_Tool in incubator
 Google book search API in Zend_Gdata
 Zend_Db_Table_Select support for Zend_Paginator
NY-PHP Zend Framework | 24-Feb-2009 | 109
What’s Next?What’s Next?
NY-PHP Zend Framework | 24-Feb-2009 | 110
Near future
• From ZF wiki:
 framework.zend.com/wiki/display/ZFPROP/Home
 In Standard Library Incubator
Zend_Action_Controller Directory Tree: Christopher Thompson
Zend_Crypt: Pádraic Brady
Zend_Db Firebird-Interbase support
Zend_MailRead Proposal: Nico Edtinger
Zend_Server Proposal: Davey Shafik
Zend_Uri Improvements: Shahar Evron
Zend_Validate_BarcodeISBN13: Andries Seutens
Zend_Mail_TransportQueue: Simon Mundy
Zend_Controller_Action_Helper_MultiPageForm: Jurriën Stutterheim
Zend_Db_Table_Plugin: Simon Mundy, Jack Sleight
Zend_Queue: Justin Plock
Zend_ Framework Default Project Structure: Wil Sinclair
Zend_FilterStripNewlines: Martin Hujer
Zend_Ascii: Ben Scholzen
Zend_CryptRsa: Pádraic Brady
Zend_Yadis: Pádraic Brady
Zend_Oauth: Pádraic Brady
Zend_View_Helper_Cycle: Kamil Nowakowski
Zend_Gravatar Proposal: Wojciech Naruniec
Zend_RememberTheMilk
Zend_Feed_Reader: Pádraic Brady & Jurriën
Stutterheim
Zend_Image_Barcode: Mickael Perraud & Julien
Pauli
Twitter
Zend_Log factory(): Martin Roest
Zend_LogWriterSyslog: Thomas Gelf
Zend_Json_Expr to allow Javascript Expressions
(functions) to be encoded using Zend_Json
Extended Zend_Ldap Proposal: Stefan Gehrig
Zend_Service_Digg: Luke Crouch
Zend_LogWriterMail
Zend_TagCloud: Ben Scholzen
Zend_LoaderAutoloader: Ralph Schindler
Zend_Markup: Pieter Kokx
Zend_Validate_Db_RecordExists:
Zend_Validate_Db_NoRecordExists: Ryan Mauger
Zend_Controller_Router_Route_Rest: Luke Crouch
Zend_Loader_Autoloader_Resource: Matthew Weier
O'Phinney
NY-PHP Zend Framework | 24-Feb-2009 | 111
Further out in the future
• Emphasis on tooling to create and deploy projects
• Look here:
framework.zend.com/wiki/display/ZFPROP/Home
NY-PHP Zend Framework | 24-Feb-2009 | 112
My goals
• For my own apps
 Write more view helpers
 Refactor pre-1.6 piecemeal Dojo code with ZF’s built-in Dojo
view helpers and form elements
 Replace homegrown database code with Zend_Db classes
• Consistent quoting, escaping, prepared statements, profiler
• And to provide feedback to developers
 Use more of Zend_Form’s power with Zend_Filter and
Zend_Validate.
• My controller actions now do too much
• ZF
 Contribute to Zend_Db_Adapter_Db2
NY-PHP Zend Framework | 24-Feb-2009 | 113
In conclusion…In conclusion…
NY-PHP Zend Framework | 24-Feb-2009 | 114
Zend Framework is…
A use-at-will component framework that is:
• built with OO, PHP 5
• intended to set a high standard for enterprise PHP
• flexible with MVC to put you on right track
• full of components that handle drudgery for you,
and web services, too
• always improving. You can contribute
NY-PHP Zend Framework | 24-Feb-2009 | 115
Resources: books
Books in
Japanese,
German,
Portuguese:
NY-PHP Zend Framework | 24-Feb-2009 | 116
• On the web:
 framework.zend.com/docs/quickstart
 survivethedeepend.com/pdf/survivethedeepend.pdf
 zfforums.com
• Send me your thoughts:
 alan@alanseiden.com
 http://alanseiden.com (my blog)
Resources: online
NY-PHP Zend Framework | 24-Feb-2009 | 117
Questions?
alan@alanseiden.com
See you at TGIF!

Weitere ähnliche Inhalte

Was ist angesagt?

PHP on IBM i Tutorial
PHP on IBM i TutorialPHP on IBM i Tutorial
PHP on IBM i TutorialZendCon
 
Building and deploying PHP applications with Phing
Building and deploying PHP applications with PhingBuilding and deploying PHP applications with Phing
Building and deploying PHP applications with PhingMichiel Rook
 
Zend Core on IBM i - Security Considerations
Zend Core on IBM i - Security ConsiderationsZend Core on IBM i - Security Considerations
Zend Core on IBM i - Security ConsiderationsZendCon
 
Best Practices in PHP Application Deployment
Best Practices in PHP Application DeploymentBest Practices in PHP Application Deployment
Best Practices in PHP Application DeploymentShahar Evron
 
Building and Deploying PHP apps with Phing
Building and Deploying PHP apps with PhingBuilding and Deploying PHP apps with Phing
Building and Deploying PHP apps with PhingMichiel Rook
 
Strategic Modernization with PHP on IBM i
Strategic Modernization with PHP on IBM iStrategic Modernization with PHP on IBM i
Strategic Modernization with PHP on IBM iAlan Seiden
 
Building and Deploying PHP Apps Using phing
Building and Deploying PHP Apps Using phingBuilding and Deploying PHP Apps Using phing
Building and Deploying PHP Apps Using phingMihail Irintchev
 
Create a welcoming development environment on IBM i
Create a welcoming development environment on IBM iCreate a welcoming development environment on IBM i
Create a welcoming development environment on IBM iAlan Seiden
 
From Zero to ZF: Your first zend framework project on ibm i
From Zero to ZF: Your first zend framework project on ibm iFrom Zero to ZF: Your first zend framework project on ibm i
From Zero to ZF: Your first zend framework project on ibm iAlan Seiden
 
Deploying PHP applications with Phing
Deploying PHP applications with PhingDeploying PHP applications with Phing
Deploying PHP applications with PhingMichiel Rook
 
Phing: Building with PHP
Phing: Building with PHPPhing: Building with PHP
Phing: Building with PHPhozn
 
Putting Phing to Work for You
Putting Phing to Work for YouPutting Phing to Work for You
Putting Phing to Work for Youhozn
 
Zend con practical-zf1-zf2-migration
Zend con practical-zf1-zf2-migrationZend con practical-zf1-zf2-migration
Zend con practical-zf1-zf2-migrationClark Everetts
 
Php Dependency Management with Composer ZendCon 2016
Php Dependency Management with Composer ZendCon 2016Php Dependency Management with Composer ZendCon 2016
Php Dependency Management with Composer ZendCon 2016Clark Everetts
 
OpenNTF Domino API (ODA): Super-Charging Domino Development
OpenNTF Domino API (ODA): Super-Charging Domino DevelopmentOpenNTF Domino API (ODA): Super-Charging Domino Development
OpenNTF Domino API (ODA): Super-Charging Domino DevelopmentPaul Withers
 
Mac Application Packaging
Mac Application PackagingMac Application Packaging
Mac Application PackagingDell World
 
Building and managing applications fast for IBM i
Building and managing applications fast for IBM iBuilding and managing applications fast for IBM i
Building and managing applications fast for IBM iZend by Rogue Wave Software
 

Was ist angesagt? (20)

PHP on IBM i Tutorial
PHP on IBM i TutorialPHP on IBM i Tutorial
PHP on IBM i Tutorial
 
Building and deploying PHP applications with Phing
Building and deploying PHP applications with PhingBuilding and deploying PHP applications with Phing
Building and deploying PHP applications with Phing
 
Zend Core on IBM i - Security Considerations
Zend Core on IBM i - Security ConsiderationsZend Core on IBM i - Security Considerations
Zend Core on IBM i - Security Considerations
 
Best Practices in PHP Application Deployment
Best Practices in PHP Application DeploymentBest Practices in PHP Application Deployment
Best Practices in PHP Application Deployment
 
Building and Deploying PHP apps with Phing
Building and Deploying PHP apps with PhingBuilding and Deploying PHP apps with Phing
Building and Deploying PHP apps with Phing
 
Strategic Modernization with PHP on IBM i
Strategic Modernization with PHP on IBM iStrategic Modernization with PHP on IBM i
Strategic Modernization with PHP on IBM i
 
Building and Deploying PHP Apps Using phing
Building and Deploying PHP Apps Using phingBuilding and Deploying PHP Apps Using phing
Building and Deploying PHP Apps Using phing
 
Create a welcoming development environment on IBM i
Create a welcoming development environment on IBM iCreate a welcoming development environment on IBM i
Create a welcoming development environment on IBM i
 
From Zero to ZF: Your first zend framework project on ibm i
From Zero to ZF: Your first zend framework project on ibm iFrom Zero to ZF: Your first zend framework project on ibm i
From Zero to ZF: Your first zend framework project on ibm i
 
Deploying PHP applications with Phing
Deploying PHP applications with PhingDeploying PHP applications with Phing
Deploying PHP applications with Phing
 
Phing: Building with PHP
Phing: Building with PHPPhing: Building with PHP
Phing: Building with PHP
 
Putting Phing to Work for You
Putting Phing to Work for YouPutting Phing to Work for You
Putting Phing to Work for You
 
Zend con practical-zf1-zf2-migration
Zend con practical-zf1-zf2-migrationZend con practical-zf1-zf2-migration
Zend con practical-zf1-zf2-migration
 
Php Dependency Management with Composer ZendCon 2016
Php Dependency Management with Composer ZendCon 2016Php Dependency Management with Composer ZendCon 2016
Php Dependency Management with Composer ZendCon 2016
 
HTML5 Refresher
HTML5 RefresherHTML5 Refresher
HTML5 Refresher
 
OpenNTF Domino API (ODA): Super-Charging Domino Development
OpenNTF Domino API (ODA): Super-Charging Domino DevelopmentOpenNTF Domino API (ODA): Super-Charging Domino Development
OpenNTF Domino API (ODA): Super-Charging Domino Development
 
Phing
PhingPhing
Phing
 
Mac Application Packaging
Mac Application PackagingMac Application Packaging
Mac Application Packaging
 
Building and managing applications fast for IBM i
Building and managing applications fast for IBM iBuilding and managing applications fast for IBM i
Building and managing applications fast for IBM i
 
Git preso to valtech cfml team
Git preso to valtech cfml teamGit preso to valtech cfml team
Git preso to valtech cfml team
 

Andere mochten auch

Burg arranque grafico en ubuntu
Burg arranque grafico en ubuntuBurg arranque grafico en ubuntu
Burg arranque grafico en ubuntussxdan
 
Acl Analytics10.5 New Features
Acl Analytics10.5 New FeaturesAcl Analytics10.5 New Features
Acl Analytics10.5 New FeaturesDataConsulting
 
Evaluation Question 1
Evaluation Question 1Evaluation Question 1
Evaluation Question 1EM6614
 
Paranormal Activity Swede Storyboard
Paranormal Activity Swede StoryboardParanormal Activity Swede Storyboard
Paranormal Activity Swede StoryboardEM6614
 
Practical Applications of Zend_Acl
Practical Applications of Zend_AclPractical Applications of Zend_Acl
Practical Applications of Zend_AclRowan Merewood
 

Andere mochten auch (7)

TDD and Getting Paid
TDD and Getting PaidTDD and Getting Paid
TDD and Getting Paid
 
Burg arranque grafico en ubuntu
Burg arranque grafico en ubuntuBurg arranque grafico en ubuntu
Burg arranque grafico en ubuntu
 
Bonus1
Bonus1Bonus1
Bonus1
 
Acl Analytics10.5 New Features
Acl Analytics10.5 New FeaturesAcl Analytics10.5 New Features
Acl Analytics10.5 New Features
 
Evaluation Question 1
Evaluation Question 1Evaluation Question 1
Evaluation Question 1
 
Paranormal Activity Swede Storyboard
Paranormal Activity Swede StoryboardParanormal Activity Swede Storyboard
Paranormal Activity Swede Storyboard
 
Practical Applications of Zend_Acl
Practical Applications of Zend_AclPractical Applications of Zend_Acl
Practical Applications of Zend_Acl
 

Ähnlich wie Edp bootstrapping a-software_company

Building Web Applications with Zend Framework
Building Web Applications with Zend FrameworkBuilding Web Applications with Zend Framework
Building Web Applications with Zend FrameworkPhil Brown
 
Zend Framework Quick Start Walkthrough
Zend Framework Quick Start WalkthroughZend Framework Quick Start Walkthrough
Zend Framework Quick Start WalkthroughBradley Holt
 
MVC with Zend Framework
MVC with Zend FrameworkMVC with Zend Framework
MVC with Zend Frameworkwebholics
 
Application development using Zend Framework
Application development using Zend FrameworkApplication development using Zend Framework
Application development using Zend FrameworkMahmud Ahsan
 
PHP QA Tools
PHP QA ToolsPHP QA Tools
PHP QA Toolsrjsmelo
 
PHP Frameworks and CodeIgniter
PHP Frameworks and CodeIgniterPHP Frameworks and CodeIgniter
PHP Frameworks and CodeIgniterKHALID C
 
Simplify your professional web development with symfony
Simplify your professional web development with symfonySimplify your professional web development with symfony
Simplify your professional web development with symfonyFrancois Zaninotto
 
Deprecated: Foundations of Zend Framework 2
Deprecated: Foundations of Zend Framework 2Deprecated: Foundations of Zend Framework 2
Deprecated: Foundations of Zend Framework 2Adam Culp
 
Zend_Tool: Practical use and Extending
Zend_Tool: Practical use and ExtendingZend_Tool: Practical use and Extending
Zend_Tool: Practical use and ExtendingZendCon
 
Getting Started with Zend Framework
Getting Started with Zend FrameworkGetting Started with Zend Framework
Getting Started with Zend FrameworkJuan Antonio
 
Unit Test for ZF SlideShare Component
Unit Test for ZF SlideShare ComponentUnit Test for ZF SlideShare Component
Unit Test for ZF SlideShare ComponentKaiuwe
 
Unit Test for ZF SlideShare Component
Unit Test for ZF SlideShare ComponentUnit Test for ZF SlideShare Component
Unit Test for ZF SlideShare ComponentKaiuwe
 
Unit Test for ZF SlideShare Component
Unit Test for ZF SlideShare ComponentUnit Test for ZF SlideShare Component
Unit Test for ZF SlideShare ComponentKaiuwe
 
Unit Test for ZF SlideShare Component
Unit Test for ZF SlideShare ComponentUnit Test for ZF SlideShare Component
Unit Test for ZF SlideShare ComponentKaiuwe
 
Zend Framework Foundations
Zend Framework FoundationsZend Framework Foundations
Zend Framework FoundationsChuck Reeves
 
Intro to drupal_7_architecture
Intro to drupal_7_architectureIntro to drupal_7_architecture
Intro to drupal_7_architectureHai Vo Hoang
 

Ähnlich wie Edp bootstrapping a-software_company (20)

Building Web Applications with Zend Framework
Building Web Applications with Zend FrameworkBuilding Web Applications with Zend Framework
Building Web Applications with Zend Framework
 
Zend Framework Quick Start Walkthrough
Zend Framework Quick Start WalkthroughZend Framework Quick Start Walkthrough
Zend Framework Quick Start Walkthrough
 
MVC with Zend Framework
MVC with Zend FrameworkMVC with Zend Framework
MVC with Zend Framework
 
Codeigniter
CodeigniterCodeigniter
Codeigniter
 
Application development using Zend Framework
Application development using Zend FrameworkApplication development using Zend Framework
Application development using Zend Framework
 
PHP QA Tools
PHP QA ToolsPHP QA Tools
PHP QA Tools
 
Zend framework
Zend frameworkZend framework
Zend framework
 
PHP Frameworks and CodeIgniter
PHP Frameworks and CodeIgniterPHP Frameworks and CodeIgniter
PHP Frameworks and CodeIgniter
 
Simplify your professional web development with symfony
Simplify your professional web development with symfonySimplify your professional web development with symfony
Simplify your professional web development with symfony
 
Deprecated: Foundations of Zend Framework 2
Deprecated: Foundations of Zend Framework 2Deprecated: Foundations of Zend Framework 2
Deprecated: Foundations of Zend Framework 2
 
Zend_Tool: Practical use and Extending
Zend_Tool: Practical use and ExtendingZend_Tool: Practical use and Extending
Zend_Tool: Practical use and Extending
 
Getting Started with Zend Framework
Getting Started with Zend FrameworkGetting Started with Zend Framework
Getting Started with Zend Framework
 
Unit Test for ZF SlideShare Component
Unit Test for ZF SlideShare ComponentUnit Test for ZF SlideShare Component
Unit Test for ZF SlideShare Component
 
Unit Test for ZF SlideShare Component
Unit Test for ZF SlideShare ComponentUnit Test for ZF SlideShare Component
Unit Test for ZF SlideShare Component
 
Unit Test for ZF SlideShare Component
Unit Test for ZF SlideShare ComponentUnit Test for ZF SlideShare Component
Unit Test for ZF SlideShare Component
 
Unit Test for ZF SlideShare Component
Unit Test for ZF SlideShare ComponentUnit Test for ZF SlideShare Component
Unit Test for ZF SlideShare Component
 
Zend Framework Foundations
Zend Framework FoundationsZend Framework Foundations
Zend Framework Foundations
 
green
greengreen
green
 
Intro to drupal_7_architecture
Intro to drupal_7_architectureIntro to drupal_7_architecture
Intro to drupal_7_architecture
 
Php myadmin
Php myadminPhp myadmin
Php myadmin
 

Kürzlich hochgeladen

ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 

Kürzlich hochgeladen (20)

ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 

Edp bootstrapping a-software_company

  • 1. Zend Framework in 2009 Alan Seiden – Strategic Business Systems alan@alanseiden.com New York PHP 24-Feb-2009
  • 2. NY-PHP Zend Framework | 24-Feb-2009 | 2 Speaker Alan Seiden: alan@alanseiden.com PHP and Zend Framework Consultant Strategic Business Systems, Inc. Contributor: Mantis/400 & IBM’s Zend Core for i5/OS Writer about PHP for IBM i5 community Mentor for teams learning Zend Framework Zend Certified Engineer—Zend Framework
  • 3. NY-PHP Zend Framework | 24-Feb-2009 | 3 Tonight we will cover: • Zend Framework (ZF) basics  What, why, how • ZF’s flexible model-view-controller (MVC) implementation  Keeps your code organized logically and handles “plumbing” • Components (libraries)  Including classes to access web services • What’s new and what’s next
  • 4. NY-PHP Zend Framework | 24-Feb-2009 | 4 What is ZF? • An open source, MVC-based PHP framework • Is it a framework? Yes  "Glue" to build applications  Components developed, tested, distributed together • But loosely coupled  “Use at will” architecture  Dependencies documented in manual • Section A.1.4. Zend Framework Dependencies
  • 5. NY-PHP Zend Framework | 24-Feb-2009 | 5 Birth and early years • 2005: PHP Collaboration Project at ZendCon  Started as collection of components but coalesced  PHP 5, object oriented (OO) from the start  Set example of OO design patterns and practices • July 2007: GA version 1.0 • February 17, 2009: version 1.75 • Frequent minor releases
  • 6. NY-PHP Zend Framework | 24-Feb-2009 | 6 What’s it made of? • Robust, high quality object-oriented PHP 5 libraries  Test-driven development • 80+% code coverage  Peer review of all code  Coding standards • http://framework.zend.com/manual/en/coding-standard.html  Components not released until documented in manual and inline • phpDocumentor format: http://phpdoc.org
  • 7. NY-PHP Zend Framework | 24-Feb-2009 | 7 Flexible License • “New BSD” license  http://framework.zend.com/license  Use code however you like • Apache-like contributor license agreement (CLA)  Safety for users/corporations  All original code; no patent claims
  • 8. NY-PHP Zend Framework | 24-Feb-2009 | 8 Why I use it • As I learn what it can do, the less boring code I write  At first, I reinvented the wheel  Realized that ZF already provided functionality  I can write less “plumbing” code • Can customize and extend  Numerous integration points  Interfaces and small methods give you control • It keeps up with trends and APIs  Compatibility with diverse database systems, authentication and other APIs  Including IBM i (AS/400)’s unique version of db2  Web services
  • 9. NY-PHP Zend Framework | 24-Feb-2009 | 9 Community • Contributors include individuals and companies. Companies include:  Zend (of course)  IBM  OmniTI • Technology partners:  Adobe, Google, IBM, Microsoft, nirvanix, StrikeIron • Help available at zfforum.com, e-mail lists, #zftalk IRC
  • 10. NY-PHP Zend Framework | 24-Feb-2009 | 10 Requirements for Zend Framework 1.75 • Required:  PHP 5.2.4+ • Optional:  mod_rewrite • Recommended; route URLs through bootstrap file  Extensions as needed. Examples: • ext/session in Zend_Session • ext/gd in Zend_Captcha  PHPUnit 3.3.0 if use Zend_TestPHPUnit • Full list of reqs and dependencies:  framework.zend.com/manual/en/requirements.html
  • 11. NY-PHP Zend Framework | 24-Feb-2009 | 11 How it’s developed
  • 12. NY-PHP Zend Framework | 24-Feb-2009 | 12 Issue tracker
  • 13. NY-PHP Zend Framework | 24-Feb-2009 | 13 Timesaving conventions • Autoloader  PEAR convention for class/file names • Example: Search_Product = Search/Product.php • Put this in bootstrap file: require_once 'Zend/Loader.php'; Zend_Loader::registerAutoload(); • Now you can do: $prod = new Search_Product(); • Fluent interface $select = $db->select() ->from( ...specify table and columns... ) ->where( ...specify search criteria... ) ->order( ...specify sorting criteria... );
  • 14. NY-PHP Zend Framework | 24-Feb-2009 | 14 Model-View-Model-View- ControllerController
  • 15. NY-PHP Zend Framework | 24-Feb-2009 | 15 Model – View – Controller design pattern • Model  Classes that access your data • View  Templates to present that data (e.g. HTML for browser) • Controller (action controller)  Application flow  Connects model and view • (Bonus: front controller!)
  • 16. NY-PHP Zend Framework | 24-Feb-2009 | 16 Front ControllerFront Controller
  • 17. NY-PHP Zend Framework | 24-Feb-2009 | 17 Front controller pattern • Front controller sits in front of MVC • All PHP requests funneled through index.php (bootstrap file) • Front controller gets your application started  Initializes request/response objects  Can handle common settings and functionality • “Include” paths • Configurations • Location of MVC components (if necessary) • Logging, db (perhaps), authentication/authorization  Converts URL to a “request” object with distinct parts  Routes requests to appropriate action controllers • Receives exceptions
  • 18. NY-PHP Zend Framework | 24-Feb-2009 | 18 Front controller to action controller
  • 19. NY-PHP Zend Framework | 24-Feb-2009 | 19 Routes URL request • Default routing convention:  http://example.com/controller/action/param1/value1... Front Controller Controller1 action1() action2() Controller2 action1() action2() Bootstrap: index.php http reques t Action maps to method name Param/value pairs are passed to action Controller maps to class name
  • 20. NY-PHP Zend Framework | 24-Feb-2009 | 20 Front controller needs two files in public folder In document root (public folder): 1. .htaccess redirects requests to bootstrap script (index.php) 2. index.php instantiates Front Controller
  • 21. NY-PHP Zend Framework | 24-Feb-2009 | 21 Front controller file #1: .htaccess RewriteEngine on # funnel all requests to index.php # except requests for static resources RewriteRule !.(js|ico|gif|jpg|png|css)$ index.php
  • 22. NY-PHP Zend Framework | 24-Feb-2009 | 22 Front controller file #2: index.php <?php // bootstrap file setincludepath('.' . PATHSEPARATOR . '../library' . PATHSEPARATOR . '../application/default/models/' . PATHSEPARATOR . getincludepath()); // Prepare the front controller $frontController = Zend_Controller_Front::getInstance(); // Dispatch the request using the front controller $frontController->dispatch();
  • 23. NY-PHP Zend Framework | 24-Feb-2009 | 23 Action ControllerAction Controller
  • 24. NY-PHP Zend Framework | 24-Feb-2009 | 24 Action Controller • Controller classes handle groups of request URLs http://example.com/controller/action Default: IndexController  Organizes and groups functionality  One class (extending Zend_Controller_Action) for each controller • Action methods in each controller class handle requests http://example.com/controller/action Default: indexAction()  Named like actionAction() • Example: If action is “edit” then method is editAction()
  • 25. NY-PHP Zend Framework | 24-Feb-2009 | 25 More controller functionality • Several standard methods help organize and control the flow  init() – called by the constructor  preDispatch() – called before the action’s method  postDispatch() – called after the action’s method • Utility methods  forward(), redirect(), getParam(), getRequest(), getResponse(), render() • Action helpers add functionality  Built-in helpers. Example: gotoSimple()  Your own helpers  Avoids the need to build your own base controller class
  • 26. NY-PHP Zend Framework | 24-Feb-2009 | 26 Controller example
  • 27. NY-PHP Zend Framework | 24-Feb-2009 | 27 Action helpers • They extend Zend_Controller_Action_Helper_Abstract • Built-in action helpers  ActionStack  AjaxContext  AutoComplete: Dojo, Scriptaculous  ContextSwitch  FlashMessenger  Json  Redirector  Url  ViewRenderer • Create your own  Place in the "My/Helper/" directory of your library (or any directory on your includepath)
  • 28. NY-PHP Zend Framework | 24-Feb-2009 | 28 Action helper example: Redirector gotoSimple() class Forward_Controller extends Zend_Controller_Action { protected $redirector = null; public function init() { $this->redirector = $this->helper->getHelper('Redirector'); } public function myAction() { /* do some stuff */ // Redirect to 'my-action' of 'my-controller' in the current // module, using the params param1 => test and param2 => test2 $this->redirector->gotoSimple('my-action', 'my-controller', null, array('param1' => 'test', 'param2' => 'test2' ) ); } }
  • 29. NY-PHP Zend Framework | 24-Feb-2009 | 29 ViewView
  • 30. NY-PHP Zend Framework | 24-Feb-2009 | 30 View • Scripts (templates)  PHP-based script templates to present data  Should contain only display logic, not business logic  Default naming: “myaction.phtml” • Helpers  Classes and methods that provide reusable view functionality • Examples of built in view helpers: escape(), formText(), partial(), partialLoop(), headTitle() • Write your own, too • Output filters • Layout • Placeholders
  • 31. NY-PHP Zend Framework | 24-Feb-2009 | 31 Controller (again)…leads to view
  • 32. NY-PHP Zend Framework | 24-Feb-2009 | 32 View script automatically rendered
  • 33. NY-PHP Zend Framework | 24-Feb-2009 | 33 Zend_Layout
  • 34. NY-PHP Zend Framework | 24-Feb-2009 | 34 Zend_Layout • Two-step view pattern  Uses Zend_View for rendering • Placeholders useful for setting javascript, titles, other variable data • Layout view helper  shortcut to layout placeholder  These are equivalent: // fetch 'content' key using layout helper: echo $this->layout()->content; // fetch ‘content' key using placeholder helper: echo $this->placeholder('Zend_Layout')->content; • Enable in bootstrap    // accept default path Zend_Layout::startMvc();    // or specify path    $layoutPath = realpath(dirname(__FILE__) .             '/../application/layouts');    Zend_Layout::startMvc(array("layoutPath“ => $layoutPath));
  • 35. NY-PHP Zend Framework | 24-Feb-2009 | 35 My own view helper: TitleCase.php <?php Require_once 'Zend/View/Interface.php'; /**  * TitleCase helper */ class Zend_View_Helper_Title_Case { public $view; public function titleCase($string = '')  {     // convert incoming string so that     // first letter of each word is capitalized/     // but all other letters are lowercase.     // Also trim the string.     return ucwords(strtolower(trim($string))); } //(public function titleCase()) public function setView(Zend_View_Interface $view) { $this->view = $view; } } Usage: echo $this->titleCase(‘mozilla  firefox’); // Mozilla Firefox
  • 36. NY-PHP Zend Framework | 24-Feb-2009 | 36 ModelModel
  • 37. NY-PHP Zend Framework | 24-Feb-2009 | 37 Model • Models are abstract representations of data  Can be extended from: • Zend_Db_Table_Row – For database abstraction • Zend_Feed_Element – For RSS abstraction • Yahoo_Result – For Yahoo abstraction • Or any other class that fits your needs • Or build your own own abstract representations of your data
  • 38. NY-PHP Zend Framework | 24-Feb-2009 | 38 Models (more) • Model classes contain business logic to prepare complex data for presentation • I stuff any “weird” code in models so that controllers/views are clean
  • 39. NY-PHP Zend Framework | 24-Feb-2009 | 39 Model: example <?php // model: Busyflag.php class Busyflag {     // The table name      protected $name = ‘SYSFLAGS'; // old-fashioned “System 36” table     // isSiteUp: return true if up, false if down     public function isSiteUp() {         // one record, with key "B"             $sql = "select BZYFLG from {$this->name} where RECID = 'B'";          $row = SBSDbhelp::getOneRow($sql);          // true if Y, false otherwise.         return $row['BZYFLG'] == 'Y';      } //(public function isSiteUp()) } //(class Busyflag) // usage (from a preDispatch front controller plugin) $busyFlag = new Busyflag(); if (!$busyFlag->isSiteUp()) {     // Take user to "site down" page.     $request->setControllerName("Down");     $request->setActionName("index"); } //(if (!$busyFlag->isSiteUp()))
  • 40. NY-PHP Zend Framework | 24-Feb-2009 | 40 Controller + Model + View: traditional <?php // Controllers/SearchController.php require_once 'Zend/Controller/Action.php'; class SearchController extends Zend_Controller_Action  { public function indexAction()      {         $prodid = $this->_getParam('prodid');                  // look up product data in model         $products = new Search_Products();         $results = $products->find($prodid);                  // assign results to view      $this->view->results = $results;      } } <?php // views/scripts/search/index.phtml ?> Products found:<ul> <?php foreach ($this->results as $result) {     echo "<li>{$this->escape($result->prodname)}</b>{$this->escape($result- >available)}</li>"; }                         ?> </ul>
  • 41. NY-PHP Zend Framework | 24-Feb-2009 | 41 MVC your way: custom routing rules • Can declare custom routing rules with Zend_Controller_Router_Route classes  Not limited to “controller/action/param” format  Example: “year/month/day/title” as in a blog posting:  URL: http://myblog.com/2008/02/24/i-like-routers  $route = new Zend_Controller_Router_Route(     ':year/:month/:day/:title',     array(         'year'       => 2009,         'controller' => ‘articles',         'action'     => 'show'     ),     array(            'year'  => 'd+‘,            ‘month' => 'd+‘,            ‘day‘   => 'd+‘,        ) ); $router->addRoute(‘posts', $route);
  • 42. NY-PHP Zend Framework | 24-Feb-2009 | 42 MVC your way: multi-MVC • Can separate app sections into modules (Mitch P.’s “atomic MVC”) $front->setControllerDirectory(array( 'default' => '/demo/application/controllers', 'blog' => '/demo/application/blog/controllers' )); • Blog_IndexController is class name of index action controller within blog app/module  URL: example.com/blog or /blog/index or /blog/index/index • IndexController is still class name within default app/module  URL: / or /index or /index/index
  • 43. NY-PHP Zend Framework | 24-Feb-2009 | 43 Tools can help get you started • Zend Studio for Eclipse creates default directory structures and classes for you  Free trial: http://www.zend.com/en/products/studio/
  • 44. NY-PHP Zend Framework | 24-Feb-2009 | 44 ComponentsComponents
  • 45. NY-PHP Zend Framework | 24-Feb-2009 | 45 Library of Zend components Reminder: Zend/Db.php = Zend_Db Zend/Db/Table.php = Zend_Db_Table
  • 46. NY-PHP Zend Framework | 24-Feb-2009 | 46 Components vs. straight PHP • Additional functionality  Zend_Session vs. straight $_SESSION  Zend_Debug::dump() vs. vardump • Thread-safety  Zend_Translate vs. gettext  Zend_Locale vs. setlocale • OO  OO Syntax  May be extended with custom functionality  ZF components reduce coding when used together • They’ve been tested and integrated for you
  • 47. NY-PHP Zend Framework | 24-Feb-2009 | 47 Components in 1.75 Zend_Acl Zend_Amf Zend_Auth Zend_Cache Zend_Captcha Zend_Config Zend_Config_Writer Zend_Console_Getopt Zend_Controller Zend_Currency Zend_Date Zend_Db Zend_Debug Zend_Dojo Zend_Dom Zend_Exception Zend_Feed Zend_File Zend_Filter Zend_FilterInput Zend_Form Zend_Gdata Zend_Http Zend_Infocard Zend_Json Zend_Layout Zend_Ldap Zend_Loader Zend_Locale Zend_Log Zend_Mail Zend_Measure Zend_Memory Zend_Mime Zend_OpenId Zend_Paginator Zend_Pdf Zend_ProgressBar Zend_Registry Zend_Rest Zend_Search_Lucene Zend_Server_Reflection Zend_Akismet Zend_Amazon Zend_Audioscrobbler Zend_Delicious Zend_Flickr Zend_Nirvanix Zend_ReCaptcha Zend_Simpy Zend_SlideShare Zend_StrikeIron Zend_Technorati Zend_Twitter Zend_Yahoo Zend_Session Zend_Soap Zend_Test Zend_Text Zend_Timesync Zend_Translate Zend_Uri Zend_Validate Zend_Version Zend_View Zend_Wildfire Zend_XmlRpc Zend_XConsoleProcessUnix Zend_XJQuery
  • 48. NY-PHP Zend Framework | 24-Feb-2009 | 48 Component categories • MVC • Formatting • Ajax • Identity, Authentication, and Authorization • Forms • Datastore • Web Services • Enterprise • Debugging, Logging, and Testing • I18n and L10n • Mail • Infrastructure
  • 49. NY-PHP Zend Framework | 24-Feb-2009 | 49 MVC components (you already know these) • Zend_Controller • Zend_Layout • Zend_View
  • 50. NY-PHP Zend Framework | 24-Feb-2009 | 50 Formatting • Zend_Text • Zend_Paginator
  • 51. NY-PHP Zend Framework | 24-Feb-2009 | 51 Ajax • Zend_Dojo • Zend_Json
  • 52. NY-PHP Zend Framework | 24-Feb-2009 | 52 Identity, authentication, and authorization • Zend_Acl • Zend_Auth • Zend_Infocard • Zend_OpenId • Zend_Session
  • 53. NY-PHP Zend Framework | 24-Feb-2009 | 53 Form and input validation • Zend_Captcha • Zend_Form • Zend_Validate • Zend_Filter
  • 54. NY-PHP Zend Framework | 24-Feb-2009 | 54 Database access • Zend_Db • Zend_Db_Table • Zend_Db_Profiler
  • 55. NY-PHP Zend Framework | 24-Feb-2009 | 55 Web services • Zend_Feed • Zend_Gdata • Zend_Http • Zend_Rest • Zend_Server_Reflection • Zend_Soap • Zend_Uri • Zend_XmlRpc
  • 56. NY-PHP Zend Framework | 24-Feb-2009 | 56 Zend_Service_* clients • Akismet • Amazon • Audioscrobbler • Delicious • Flickr • Nirvanix • ReCaptcha • Simpy • SlideShare • StrikeIron • Technorati • Twitter • Yahoo
  • 57. NY-PHP Zend Framework | 24-Feb-2009 | 57 Additional categories • Zend_Ldap • Zend_Search_Lucene • Zend_Pdf
  • 58. NY-PHP Zend Framework | 24-Feb-2009 | 58 Debugging, logging, and testing • Zend_Debug • Zend_Log • Zend_Test • Zend_Wildfire
  • 59. NY-PHP Zend Framework | 24-Feb-2009 | 59 I18n and L10n • Zend_Currency • Zend_Calendar • Zend_Date • Zend_Locale • Zend_Measure • Zend_TimeSync • Zend_Translate
  • 60. NY-PHP Zend Framework | 24-Feb-2009 | 60 Mail • Zend_Mail • Zend_Mime
  • 61. NY-PHP Zend Framework | 24-Feb-2009 | 61 Infrastructure • Zend_Cache • Zend_Config • Zend_Console • Zend_File • Zend_Loader • Zend_Memory • Zend_Registry • Zend_Version
  • 62. NY-PHP Zend Framework | 24-Feb-2009 | 62 RegistryRegistry
  • 63. NY-PHP Zend Framework | 24-Feb-2009 | 63 Registry • Store global data without polluting the global scope  Zend_Registry::set(‘key’, $value);  Zend_Registry::get(‘key’);  Useful for storing sessions, configuration data or any data that could potentially be important on a per-request basis
  • 64. NY-PHP Zend Framework | 24-Feb-2009 | 64 LoggingLogging
  • 65. NY-PHP Zend Framework | 24-Feb-2009 | 65 Logging • Structured, flexible logging class • Zend_Log has several backends  Stream (write to a file)  Firebug  Mail  Db • Example of logging to file system $writer = new Zend_Log_Writer_Stream('/path/to/logfile'); // Only email warning level entries and higher. $writer->addFilter(Zend_Log::WARN); $logger = new Zend_Log($writer); // later… $logger->info('Informational message'); $logger->err(‘Error message'); // “Error message”
  • 66. NY-PHP Zend Framework | 24-Feb-2009 | 66 Logging: Firebug backend • Zend_Log_Writer_Firebug, Zend_Db_Profiler_Firebug • Install Firebug and FirePHP in Firefox // in bootstrap $logger = new Zend_Log(); $writer = new Zend_Log_Writer_Firebug(); $logger->addWriter($writer); Zend_Registry::set('logger',$logger); // in action controller or anywhere $logger = Zend_Registry::get('logger'); $logger->log(‘Log message', Zend_Log::DEBUG); $logger->log(‘Info message', Zend_Log::INFO); $logger->log(‘Warn message', Zend_Log::WARN); $logger->log(‘Error message', Zend_Log::ERR);
  • 67. NY-PHP Zend Framework | 24-Feb-2009 | 67 ConfigConfig
  • 68. NY-PHP Zend Framework | 24-Feb-2009 | 68 Zend_Config • OO syntax for reading/writing config files • Internally it’s an array • Multiple backends  INI  XML • Divide sections with [ ], good for dev/prod  And hierarchichy with periods after that • db.params.username = xxxx • Many components accept Zend_Config object as well as array  Db  Forms
  • 69. NY-PHP Zend Framework | 24-Feb-2009 | 69 Config + Registry Config.ini: [dev] db.adapter = PDO_MYSQL db.params.username = admin db.params.password = xxxx db.params.dbname = appdb db.params.host = 192.168.9.1 log.filename = /appdev/logs/app.log $config = new Zend_Config_Ini(realpath(dirname(__FILE__) . '/../application/config.ini'), 'dev'); $registry = Zend_Registry::getInstance(); $registry->set('config', $config); $db = Zend_Db::factory($config->db); Zend_Db_Table::setDefaultAdapter($db); $registry->set('db', $db); // create logger; store it in registry $logFile = $registry->get('config')->log->filename; $writer = new Zend_Log_Writer_Stream($logFile); $logger = new Zend_Log($writer); $registry->set('logger', $logger);
  • 70. NY-PHP Zend Framework | 24-Feb-2009 | 70 SessionsSessions
  • 71. NY-PHP Zend Framework | 24-Feb-2009 | 71 Sessions • Zend_Session does more than PHP’s ext/session  Namespaces let multiple applications (or sections of application) run in the same $_SESSION without risking key name collision  Used by Zend_Auth by default  Can set data to expire based on time or clicks/requests $s = new Zend_Session_Namespace(‘myNamespace'); $s->a = 'apple'; $s->p = 'pear'; $s->o = 'orange'; $s->setExpirationSeconds(5, 'a'); // expire only the key "a" in 5 seconds // expire entire namespace in 5 "hops" $s->setExpirationHops(5); $s->setExpirationSeconds(60); // The "expireAll" namespace will be marked "expired" on // the first request received after 60 seconds have elapsed, // or in 5 hops, whichever happens first.
  • 72. NY-PHP Zend Framework | 24-Feb-2009 | 72 AuthenticationAuthentication
  • 73. NY-PHP Zend Framework | 24-Feb-2009 | 73 Authentication • Built over an adapter that implements Zend_Auth_Adapter_Interface  Must have an authenticate() method that returns a Zend_Auth_Result object • Several pre-defined adapter classes can authenticate against common data stores  Zend_Auth_Adapter_Db_Table, Digest, Http, Ldap, Openid • Zend_Auth_Storage_Session uses a session namespace of "Zend_Auth" by default
  • 74. NY-PHP Zend Framework | 24-Feb-2009 | 74 Authentication example // created db adapter earlier $dbAdapter=Zend_Registry::get('db'); $authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter); $authAdapter ->setTableName('users') ->setIdentityColumn('username') ->setCredentialColumn('password') ; // Perform the authentication query, saving the result in $_SESSION $result = $authAdapter->authenticate(); if($result->isValid) { echo ‘logged in’; } else { echo ‘failed’; } // Print the result row print_r($authAdapter->getResultRowObject()); /* Output: my_username Array ( [id] => 1 [username] => my_username [password] => my_password [real_name] => My Real Name ) */
  • 75. NY-PHP Zend Framework | 24-Feb-2009 | 75 AuthorizationAuthorization
  • 76. NY-PHP Zend Framework | 24-Feb-2009 | 76 Authorization • Classes used  Zend_Acl_Role  Zend_Acl_Resource • Three concepts  Role • Assigns particular groups of access to an individual  Resource • An object to which access is controlled • Resources can have privileges (e.g., "create", "read", "update", "delete")  Access Control List (ACL) • A hierarchical list that connects role/resource permissions
  • 77. NY-PHP Zend Framework | 24-Feb-2009 | 77 Authorization $acl = new Zend_Acl(); $acl->addRole(new Zend_Acl_Role('guest')) ->addRole(new Zend_Acl_Role('member')) ->addRole(new Zend_Acl_Role('admin')); $parents = array('guest', 'member', 'admin'); $acl->addRole(new Zend_Acl_Role('someUser'), $parents); $acl->add(new Zend_Acl_Resource('someResource')); $acl->deny('guest', 'someResource'); $acl->allow('member', 'someResource'); echo $acl->isAllowed('someUser', 'someResource') ? 'allowed' : 'denied';
  • 78. NY-PHP Zend Framework | 24-Feb-2009 | 78 FormsForms
  • 79. NY-PHP Zend Framework | 24-Feb-2009 | 79 Zend_Form • Flexible solution for building forms • Create in code  Put it in a model class • Or create in config file • Factory pattern lets you determine element type at runtime • Pass $form to view script, where it’s output  echo $form; or  echo $form->ordernum; or  echo $form->getElement(‘ordernum’); • Decorators
  • 80. NY-PHP Zend Framework | 24-Feb-2009 | 80 Zend_Form example class My_Form extends Zend_Form { $form->addElement('text', 'username', array( 'validators' => array( 'alnum', array('regex', false, '/^[a-z]/i') ), 'required' => true, 'filters' => array('StringToLower'), )); } // in your controller… $form = new My_Form(); $this->view = $form // in your view… cho $this->form;
  • 81. NY-PHP Zend Framework | 24-Feb-2009 | 81 AJAX/DojoAJAX/Dojo
  • 82. NY-PHP Zend Framework | 24-Feb-2009 | 82 Dojo Integration Since May 2008 Integration points: • JSON-RPC Server • dojo.data Envelopes • Dojo View Helper • Dijit integration with Zend_Form & Zend_View • Dojo Library Re-distribution • Also JQuery in extras folder +
  • 83. NY-PHP Zend Framework | 24-Feb-2009 | 83 Zend_Dojo_Form class My_Form extends Zend_Dojo_Form { protected $_selectOptions = array( 'red' => 'Rouge', 'blue' => 'Bleu', 'white' => 'Blanc', 'orange' => 'Orange', 'black' => 'Noir', 'green' => 'Vert', ); $this->addElement( 'FilteringSelect', 'filterselect', array( 'label' => 'FilteringSelect (select)', 'value' => 'blue', 'autocomplete' => false, 'multiOptions' => $this->_selectOptions, ) ) }
  • 84. NY-PHP Zend Framework | 24-Feb-2009 | 84 DatabasesDatabases
  • 85. NY-PHP Zend Framework | 24-Feb-2009 | 85 Databases • Adapters for various database drivers  IBM DB2/informix (PDO)  IBM DB2 and DB2/i5 (IBM i) (non-PDO)  Firebird/Interbase (non-PDO)  MS SQL (PDO)  MySQL (PDO) and MySQLi (non-PDO)  Oracle (PDO and non-PDO)  PostgreSQL (PDO)  SQLite (PDO)  or build your own by extending Zend_Db_Adapter_Abstract
  • 86. NY-PHP Zend Framework | 24-Feb-2009 | 86 Databases: connect $db = new Zend_Db_Adapter_Pdo_Mysql(array( 'host' => '127.0.0.1', 'username' => 'webuser', 'password' => 'xxxxxxxx', 'dbname' => 'test' ));
  • 87. NY-PHP Zend Framework | 24-Feb-2009 | 87 Databases • Several classes give you a good start  Zend_Db_Adapter_Abstract • Abstract class for all adapters • You will most likely use this or concrete implementations (such as Zend_Db_Adapter_Pdo_Mysql) for your database access  Zend_Db_Table • Gateway class for doing queries on a given table  Zend_Db_Table_Row • An instance of a given row  Zend_Db_Statement
  • 88. NY-PHP Zend Framework | 24-Feb-2009 | 88 Zend_Db examples // Using "select" method to select and display records $rows = $db->select()->from('CUSTOMERS') ->where('CUSTNO >= 0'); // or write your own SQL with parameters $sql = 'SELECT * FROM CUSTOMERS WHERE CUSTNO > ? and CUSTNO < ?'; $rows = $db->fetchAll($sql, array(100, 2000)); // either way, output results foreach ($rows as $row) { echo $row['CUSTNO'] . ' ' . $row['CUSTNAME']; }
  • 89. NY-PHP Zend Framework | 24-Feb-2009 | 89 Zend_Db_Table example class Orders extends Zend_Db_Table_Abstract { protected $_name = ‘orders'; } // instantiating your class $db = Zend_Db::factory('PDO_MYSQL', $options); // don’t need to specify db if used setDefaultAdapter method earlier // Zend_Db_Table_Abstract::setDefaultAdapter($db); $table = new Orders(array('db' => $db)); $data = array( ‘custid' => ‘12345', ‘custname' => ‘Irving Jones’, ); $table->insert($data);
  • 90. NY-PHP Zend Framework | 24-Feb-2009 | 90 CachingCaching
  • 91. NY-PHP Zend Framework | 24-Feb-2009 | 91 Caching • Frontend  Core  Output  Function  File  Class • Backend  Apc  File  Memcached  Sqlite  ZendPlatform
  • 92. NY-PHP Zend Framework | 24-Feb-2009 | 92 Caching $frontendOptions = array( 'lifetime' => 7200 ); $backendOptions = array( 'cache_dir' => '../application/cache/' ); $cache = Zend_Cache::factory(‘Output’, ‘File’, $frontendOptions, $backendOptions); if (!($cache->start(‘name-of-cached-item’)) { // produce output $cache->end(); }
  • 93. NY-PHP Zend Framework | 24-Feb-2009 | 93 Unit TestsUnit Tests
  • 94. NY-PHP Zend Framework | 24-Feb-2009 | 94 Zend_Test_PHPUnit • Extend Zend_Test_PHPUnit_ControllerTestCase class User_Controller_Test extends Zend_Test_PHPUnit_ControllerTestCase { // ... public function testCallWithoutActionShouldPullFromIndexAction() { $this->dispatch('/user'); $this->assertController('user'); $this->assertAction('index'); } public function testLoginFormShouldContainLoginAndRegistrationForms() { $this->dispatch('/user'); $this->assertQueryCount('form', 2); } }
  • 95. NY-PHP Zend Framework | 24-Feb-2009 | 95 More testing examples • Valid response codes and login
  • 96. NY-PHP Zend Framework | 24-Feb-2009 | 96 ValidationValidation
  • 97. NY-PHP Zend Framework | 24-Feb-2009 | 97 Validation • Uses the Zend_Validate* classes $check = new Zend_Validate_Alnum(); if ($check->isValid($GET[‘data’])) { // do stuff } • Each class extends the Zend_Validate_Interface interface  You can use the internal validation classes or build your own
  • 98. NY-PHP Zend Framework | 24-Feb-2009 | 98 Validation • Pre-defined classes Alnum Alpha Between Ccnum Date Digits EmailAddress Float GreaterThan Hex Hostname InArray Int Ip LessThan NotEmpty Regex StringLength
  • 99. NY-PHP Zend Framework | 24-Feb-2009 | 99 Web ServicesWeb Services
  • 100. NY-PHP Zend Framework | 24-Feb-2009 | 100 Client for web services • Interfaces into web service providers  Example: Google data Calendar Docs Exif Feed Gapps Gbase Geo Media Photos Query Spreadsheets YouTube
  • 101. NY-PHP Zend Framework | 24-Feb-2009 | 101 Client classes for web services • Akismet • Amazon • Audioscrobbler • Delicious • Flickr • Nirvanix • ReCaptcha • Simpy • SlideShare • StrikeIron • Technorati • Twitter • Yahoo
  • 102. NY-PHP Zend Framework | 24-Feb-2009 | 102 Zend_Service_Yahoo • Search the web with Yahoo  Get your application ID from http://developer.yahoo.com/wsregapp/  Class uses Zend_Rest_Client under the covers  Returns Zend_Service_Yahoo_WebResultSet containing instances of Zend_Service_Yahoo_WebResult $yahoo = new Zend_Service_Yahoo("YAHOO_APPLICATION_ID"); $results = $yahoo->webSearch('IBM PHP', array('results' => ‘10', 'start' => 1)); foreach ($results as $result) { echo '<b>' . $result->Title . '</b> ' . $result->Url . '<br />'; }
  • 103. NY-PHP Zend Framework | 24-Feb-2009 | 103 Results from $yahoo->webSearch
  • 104. NY-PHP Zend Framework | 24-Feb-2009 | 104 Other Yahoo search methods • $yahoo->imageSearch • $yahoo->videoSearch • $yahoo->localSearch • $yahoo->newsSearch
  • 105. NY-PHP Zend Framework | 24-Feb-2009 | 105 News FeedsNews Feeds
  • 106. NY-PHP Zend Framework | 24-Feb-2009 | 106 Importing news feeds • Usage $feed = Zend_Feed::import($url);  Returns an instance of Zend_Feed_Abstract • Implements the Iterator interface • Understands  RSS 1.0  RSS 2.0  Atom
  • 107. NY-PHP Zend Framework | 24-Feb-2009 | 107 What’s New?What’s New?
  • 108. NY-PHP Zend Framework | 24-Feb-2009 | 108 New in ZF 1.7x • Just a few of the enhancements:  Performance enhancements in Zend_Loader, Zend_Controller, and server components  Zend_Amf component  Dojo Toolkit 1.2.1  ZendX_JQuery component  Zend_Tool in incubator  Google book search API in Zend_Gdata  Zend_Db_Table_Select support for Zend_Paginator
  • 109. NY-PHP Zend Framework | 24-Feb-2009 | 109 What’s Next?What’s Next?
  • 110. NY-PHP Zend Framework | 24-Feb-2009 | 110 Near future • From ZF wiki:  framework.zend.com/wiki/display/ZFPROP/Home  In Standard Library Incubator Zend_Action_Controller Directory Tree: Christopher Thompson Zend_Crypt: Pádraic Brady Zend_Db Firebird-Interbase support Zend_MailRead Proposal: Nico Edtinger Zend_Server Proposal: Davey Shafik Zend_Uri Improvements: Shahar Evron Zend_Validate_BarcodeISBN13: Andries Seutens Zend_Mail_TransportQueue: Simon Mundy Zend_Controller_Action_Helper_MultiPageForm: Jurriën Stutterheim Zend_Db_Table_Plugin: Simon Mundy, Jack Sleight Zend_Queue: Justin Plock Zend_ Framework Default Project Structure: Wil Sinclair Zend_FilterStripNewlines: Martin Hujer Zend_Ascii: Ben Scholzen Zend_CryptRsa: Pádraic Brady Zend_Yadis: Pádraic Brady Zend_Oauth: Pádraic Brady Zend_View_Helper_Cycle: Kamil Nowakowski Zend_Gravatar Proposal: Wojciech Naruniec Zend_RememberTheMilk Zend_Feed_Reader: Pádraic Brady & Jurriën Stutterheim Zend_Image_Barcode: Mickael Perraud & Julien Pauli Twitter Zend_Log factory(): Martin Roest Zend_LogWriterSyslog: Thomas Gelf Zend_Json_Expr to allow Javascript Expressions (functions) to be encoded using Zend_Json Extended Zend_Ldap Proposal: Stefan Gehrig Zend_Service_Digg: Luke Crouch Zend_LogWriterMail Zend_TagCloud: Ben Scholzen Zend_LoaderAutoloader: Ralph Schindler Zend_Markup: Pieter Kokx Zend_Validate_Db_RecordExists: Zend_Validate_Db_NoRecordExists: Ryan Mauger Zend_Controller_Router_Route_Rest: Luke Crouch Zend_Loader_Autoloader_Resource: Matthew Weier O'Phinney
  • 111. NY-PHP Zend Framework | 24-Feb-2009 | 111 Further out in the future • Emphasis on tooling to create and deploy projects • Look here: framework.zend.com/wiki/display/ZFPROP/Home
  • 112. NY-PHP Zend Framework | 24-Feb-2009 | 112 My goals • For my own apps  Write more view helpers  Refactor pre-1.6 piecemeal Dojo code with ZF’s built-in Dojo view helpers and form elements  Replace homegrown database code with Zend_Db classes • Consistent quoting, escaping, prepared statements, profiler • And to provide feedback to developers  Use more of Zend_Form’s power with Zend_Filter and Zend_Validate. • My controller actions now do too much • ZF  Contribute to Zend_Db_Adapter_Db2
  • 113. NY-PHP Zend Framework | 24-Feb-2009 | 113 In conclusion…In conclusion…
  • 114. NY-PHP Zend Framework | 24-Feb-2009 | 114 Zend Framework is… A use-at-will component framework that is: • built with OO, PHP 5 • intended to set a high standard for enterprise PHP • flexible with MVC to put you on right track • full of components that handle drudgery for you, and web services, too • always improving. You can contribute
  • 115. NY-PHP Zend Framework | 24-Feb-2009 | 115 Resources: books Books in Japanese, German, Portuguese:
  • 116. NY-PHP Zend Framework | 24-Feb-2009 | 116 • On the web:  framework.zend.com/docs/quickstart  survivethedeepend.com/pdf/survivethedeepend.pdf  zfforums.com • Send me your thoughts:  alan@alanseiden.com  http://alanseiden.com (my blog) Resources: online
  • 117. NY-PHP Zend Framework | 24-Feb-2009 | 117 Questions? alan@alanseiden.com See you at TGIF!