Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

[Conférence Frameworks PHP à EPITA] - 19/03/2009 - Présentation eZ Components.pdf


Published on

Published in: Technology, Education
  • Be the first to comment

  • Be the first to like this

[Conférence Frameworks PHP à EPITA] - 19/03/2009 - Présentation eZ Components.pdf

  1. 1. PHP Frameworks: Introduction to eZ Components Roland Benedetti, Gaetano Giunta EPITA, Paris 19/3/2009
  2. 2. Agenda Introduction ● Architecture and design ● New in the latest releases ● Roadmap ● Examples of usage ● Questions / other ● 2/21
  3. 3. eZ Components – what is it? « a high-quality library of independent components that aid in the development of Web-centric applications » That is... Not a framework ... but a set of loosely coupled components. They can be used individually or together Not geared exclusively towards web development ... but especially suited to web development Available with a New BSD license and support from eZ Systems 3/21
  4. 4. Goals of the library A solid platform to ease development of applications in PHP 5 ● relieving the coders from reinventing the wheel every time Simple and consistent API, OO « clean » design ● Do not impose a structure on everything: not a framework ● Keep full binary and API compatibility as long as possible ● High priority given to stability and regression avoidance ● 100% Open Source, clear attribution of rights ● Developed, maintained and supported by eZ Systems ● 4/21
  5. 5. Development methodologies Take full advantage of libraries and language functionality ● available from PHP 5.1 (minimum supported version: 5.1.6 / 5.2.1, depending on release) Every API is discussed and documented in a design doc before ● being implemented Pervasive usage of unit testing – tests are written BEFORE ● code Both inline (phpdoc à gogo) and offline (tutorials, reference, ● installation guide) documentation. Documentation is written during development, not afterwards ● 5/21
  6. 6. Architecture: class naming Usage of a prefix, because of lack of namespacing (waiting for ● PHP 5.3): ezcXXX Readable: better long understandable names than short and ● cryptic Sometimes « adjusted » for readability ● eg: ezcMailSmtpTransport vs. EzcMailSMTPTransport ezcTestSuite vs. PHPUnit2_Framework_TestSuite ...and many other rules you can find on ● 6/21
  7. 7. Architecture: dependencies The less, the better... ● ... avoiding duplication of code ● Only where necessary ● Usage of separate ● Components to implement them 7/21
  8. 8. General class schema Classes are grouped into Packages 8/21
  9. 9. Components galore! Cool stuff Boring stuff Cache Database abstraction ● ● (including ddl manipulation) ImageAnalysis and ● PersistentObject ● Conversion Authentication ● Graph Template ● ● Configuration Workflow ● ● Eventlog and Debug ● Webdav Mail ● ● ConsoleTools Search (new!) ● ● Feed (new!) ● Document (new!) MVC (new!) ● ● 9/21
  10. 10. Latest additions: 2008.1 New component: Document. It allows to convert documents ● between different formats (at the moment conversion from ReST to XHTML and DocBook is supported) New component: Feed. It parses and generates RSS1, RSS2 and ● ATOM feeds New component: Search. provides a unified interface to ● different search engine back-ends (at the moment, only a Solr back-end is supported) Improved: hierarchical caching in the Cache component; Cairo ● driver support for the Graph component; binary data support in PersistentObject, integration between Translation and Template; etc... 10/21
  11. 11. Latest additions: 2008.2 New component: MvcTools (we are a framework after all!) ● Improved: Document supports wiki (Confluence, Creole and ● DokuWiki style) and eZ Publish xml formats, reads xhtml, writes ReST Improved: Webdav supports authentication and authorization, ● shared and exclusive write locks 11/21
  12. 12. Roadmap: 2009.1 Focus: improve the new MVC support in eZ Components by ● making it both more powerful and easier to use Introduce the quot;Frameworkquot; component Authentication: add support for OpenID 2 ● Document: support for PDF writing and the support of layouts ● while writing; support for ODF reading and writing and the support of layouts while writing Search: support for the Zend_Search_Lucene backend ● PersistentObject: automatic fetching of related objects; identity ● mapping to avoid having 2 objects with the same db state 12/21
  13. 13. System Requirements PHP version 5.2.1 (for 2008.2 and later) ● Some php extensions are needed by some components, or thay ● are transparently used to provide extra features ex: Archive needs zlib (present in the default install of PHP) and ● bz2, opzionally can use « posix » for management of file permissions Detailed list at: ● (it includes a quick reference on compilation of missing extensions) 13/21
  14. 14. Development environment: tips Always develop with display_errors = On, log_errors = On, ● error_reporting = E_ALL set in php.ini Quiz: where is the PHP error log? And the webserver one? ● XDebug - best friend of OOP PHP (and many others): ● Complete stack traces – Step-by-step debugging (using appropriate IDE) – code coverage analysis (needs visualization tools) – Profiling (with kcachegrind/wincachegrind) – Sever status and configuration pages: mod_info, mod_status, ● phpinfo.php, apc.php/eaccelerator.php/xcache.php 14/21
  15. 15. Dev. environment: more tips Cannot do web development without: Firebug ● Many other useful Firefox extensions: « Web developer », ● « YSlow », « LiveHTTPHeaders », « IETab », « Console2 », «Selenium IDE» For developers on windows: UNXUTILS (from ● In production environments: ● Always use an opcode cache (APC, Eaccelerator, Xcache, – Zend) Sever status and configuration pages: mod_info, – mod_status, phpinfo.php, apc.php/xcache.php/... 15/21
  16. 16. Installation 1: via PEAR 1. Set up properly PHP 5.2 and PEAR 2. Add the channel to the PEAR installer pear channel-discover 3. Download the components pear install -a ezc/eZComponents To upgrade an existing installation: ● pear upgrade ezc/eZComponents pear help <commandname> is your friend! ● 16/21
  17. 17. Installation 2: via SVN For developers interested in the development of the library or needing a patch that has just been implemented 1. Set up properly PHP 5.2 and an svn client 2. Create an install directory and download the components in it svn co 3. Download and run the script tho set up the dev environment svn co ./scripts/ (or scriptssetup-env.bat) It is of course possible to checkou only some components - take ● care about dependencies! 17/21
  18. 18. Installation 3: quot;old skoolquot; (aka manually) 1. Download and decompress the tarball wget ezcomponents-2008.2.1.tar.bz2 tar -xjf ezcomponents-2008.2.1.tar.bz2 3. Set up properly the PHP Include Path (there's no 2!) 18/21
  19. 19. Configuration Include path: automatically set up by PEAR, otherwise the root ● dir where the software has been downladed needs to be added Autoload: all the eZComponents classes are automatically ● loaded from ezcBase (no need to include_once/require_once) require_once quot;Base/base.phpquot;; function __autoload( $className ) { ezcBase::autoload( $className ); } NB: for installations by SVN o tarball ● require_once quot;Base/src/base.phpquot;; 19/21
  20. 20. And now... The code! 20/21
  21. 21. Questions? Thanks for the attention! Gaetano Giunta Senior consultant eZ Systems Western Europe email : 21/21