PHP development with Eclipse PDT 2.0




Bastian Feder                                IPC 2009
papaya Software GmbH       ...
Me, myself & I
           Application developer
           PHP since 2001
           @papaya since
            01.2008
...
Agenda
   Installation
   Views & Perspectives
   Projects
   Templates
   Code completion
   What's new?
   Tips &...
Installation
   Download latest revision from Eclipse website
    (http://www.eclipse.org/pdt/downloads)
    ▹   All in o...
Views & Perspectives
   Perspective
    (Window > Open Perspektive)
    ▹   Arrangement of Views:
        PHP Perspektive...
Views & Perspectives (II)
Projects
        Organizational untis
        Customizable
         configuration
        PHP include path
           ▹...
Templates
   Contextual predefined
    code snippets
   Configure at
    Preferences > PHP >
    Templates
Code templates
   Activation key:
    <CTRL> + space
   Code templates
    ▹   Eases typing of complex code structures
 ...
Code templates (II)
   Capable of code completion
   Set cursor positioning (${cursor}, ${})
   Dynamic content by use ...
File templates
   File templates
    ▹   Create new files with
        standardized
        structures
    ▹   Easy to cr...
Code completion
                     (Code Assist)
   Configuration via
    Preferences > PHP > Editor > Code Assist
Code completion (II)
                         (Code Assist)
   Activation key
    <CTRL> + space
   Completes
    ▹   PH...
Code completion (III)
     (Code Assist)
Code completion (IV)
                                                  (Code Assist)
   Documentation hint
          ▪   ...
What's new in PDT 2.0?
   Less dependencies
   Improved indexing and caching
    ▹ cleanup of unnecessary depedencies to...
What's new in PDT 2.0? (II)
   Enhanced features to support OOP in PHP
    ▹   Overwrite Indicators
What's new in PDT 2.0? (III)
   Enhanced features to support OOP in PHP
    ▹   Type & name
        hierarchies
External Tools Framework
   Enables Eclipse to run ,stand-alone'
    applications
   Two broad classes of external tools...
External Tools Framework (II)
External Tools Framework (III)
   Loaction
    Linux / Mac OsX: points to the
    phpDocumentor installation

    Windows...
External Tools Framework (III)
   Display in favorits
    menu

   Standard input &
    output
xDebug
   Debugging for PHP by Derick Rethans
    (http://www.xdebug.org)
   Provides profiling, tracing, code coverage,...
xDebug configuration
   Add to php.ini (e.g. on Mac)
 [XDebug]
 ;; Only Zend OR (!) XDebug
 zend_extension=quot;/Applicat...
xDebug (III)
   Debug dialog
xDebug (IV)
   Configure PDT to talk to xDebug
xDebug (IV)
   Configure the 'Server' handling the debugging
    session
Tips and Tricks (Configuration)
   Heap space (memory allocated by JVM)
    size depends on system memory capacity
    ▹ ...
Plugins
   Subclipse
    managing SVN repositories from inside Eclipse
   JSEclipse
    Provides additional features sup...
Subclipse (installation)
   Eclipse update site:
    http://subclipse.tigris.org/update
Subclipse (configuration)
      Set „auto-properties“
        ▹   WinXp:
            C:Dokumente und Einstellungen<USER>A...
Subclipse (conflict handling)
   Integrated (diff-) editor to resolve conflicts
   Support for merging changes which do ...
Questions?




             Further questions? Ask me at:

             lapistano@php.net
References
   Eclipse PDT
    (http://www.eclipse.org/pdt)

   Eclipse plugins
     ▹   Subclipse (http://subclipse.tigr...
License
   This set of slides and the source code included
    in the download package is licensed under the

        Cre...
Upcoming SlideShare
Loading in …5
×

Eclipse Pdt2.0 26.05.2009

2,113 views
1,999 views

Published on

In late december 2008 the Eclipse Foundation and the PDT developer team released the Eclipse PHP Development Platform version 2.0. This release comes with a number of enhancements and improvements to the prior version of PDT.
This talk is about these changes. It also gives you an introduction how to prepare your Eclipse PDT workspace to be an accessible and provding companion for your daily work by integrating xDebug, subversive and phpDocumentor using the external tools platform.

Published in: Self Improvement, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,113
On SlideShare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
Downloads
11
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Eclipse Pdt2.0 26.05.2009

  1. 1. PHP development with Eclipse PDT 2.0 Bastian Feder IPC 2009 papaya Software GmbH 26.05.2009
  2. 2. Me, myself & I  Application developer  PHP since 2001  @papaya since 01.2008  OpenSource addict
  3. 3. Agenda  Installation  Views & Perspectives  Projects  Templates  Code completion  What's new?  Tips & Tricks  External Tools Framework  xDebug integration  Plugins
  4. 4. Installation  Download latest revision from Eclipse website (http://www.eclipse.org/pdt/downloads) ▹ All in one (recommended): provides everything you need to run PDT ▹ PDT Feature / Update Manager: extends an existing Eclipse, but all dependencies PDT relies on needs to be installed first.  Extract archive  Copy to favorized location (e.g. /usr/local/bin/ or another location in your application path)
  5. 5. Views & Perspectives  Perspective (Window > Open Perspektive) ▹ Arrangement of Views: PHP Perspektive contains e.g. 'PHP Explorer', 'Outline' and 'Project Outline'  Views or Tabs (Window > Show View) ▹ Viewport providing specific information and/or functionality
  6. 6. Views & Perspectives (II)
  7. 7. Projects  Organizational untis  Customizable configuration  PHP include path ▹ Validation  Build rules ▹ included resources ▹ excluded resources
  8. 8. Templates  Contextual predefined code snippets  Configure at Preferences > PHP > Templates
  9. 9. Code templates  Activation key: <CTRL> + space  Code templates ▹ Eases typing of complex code structures (e.g. switch – statement) ▹ Minimize errors switch ($action) { ▹ Act like a form case 'read': ; break; default: ; break; }
  10. 10. Code templates (II)  Capable of code completion  Set cursor positioning (${cursor}, ${})  Dynamic content by use of variables ▹ ${class} switch (${dollar}${variable}) { ▹ ${function} case ${value}: ${cursor}; ▹ ${variable} break; ▹ ${value} default: ; break; }
  11. 11. File templates  File templates ▹ Create new files with standardized structures ▹ Easy to create or adapt
  12. 12. Code completion (Code Assist)  Configuration via Preferences > PHP > Editor > Code Assist
  13. 13. Code completion (II) (Code Assist)  Activation key <CTRL> + space  Completes ▹ PHP functions ▹ Classes & functions ▹ Constants ▹ Code templates  Evolves with every plugin supporting this feature (e.g. JSEclipse)
  14. 14. Code completion (III) (Code Assist)
  15. 15. Code completion (IV) (Code Assist)  Documentation hint ▪ declaring the name of a class to be instantiated as the type of the 'local' class var will enable Eclipse to resolve the methods of the instantiated class: class docuDb { class docuHint { private function connect() { /** return $this->dbHandler->connect(); * @var docuDb Database handling } */ } private $dbHandler = NULL; private function connectToDB() { $this->dbHandler = &new docuDb(); $dbh = $this->dbHandler->connect(); } }
  16. 16. What's new in PDT 2.0?  Less dependencies  Improved indexing and caching ▹ cleanup of unnecessary depedencies to Java  Mark occurrences  Configurable Buildpathes  Improved code completion ▹ Camelcase matching
  17. 17. What's new in PDT 2.0? (II)  Enhanced features to support OOP in PHP ▹ Overwrite Indicators
  18. 18. What's new in PDT 2.0? (III)  Enhanced features to support OOP in PHP ▹ Type & name hierarchies
  19. 19. External Tools Framework  Enables Eclipse to run ,stand-alone' applications  Two broad classes of external tools are available: ▹ Ant build files ▹ Everything else
  20. 20. External Tools Framework (II)
  21. 21. External Tools Framework (III)  Loaction Linux / Mac OsX: points to the phpDocumentor installation Windows: points to the PHP executable  Working directory directory to store temporary data  Arguments Linux/ Mac OsX: command line parameters to be passed to phpDocumentor. Windows: path to the phpDocumentor installation and command line parameters (e.g.: quot;D:xamppphpphpdocquot; -c quot;$ {project_loc}/doc/tech/config/phpdoc.iniquot;)
  22. 22. External Tools Framework (III)  Display in favorits menu  Standard input & output
  23. 23. xDebug  Debugging for PHP by Derick Rethans (http://www.xdebug.org)  Provides profiling, tracing, code coverage, …  Cross platform
  24. 24. xDebug configuration  Add to php.ini (e.g. on Mac) [XDebug] ;; Only Zend OR (!) XDebug zend_extension=quot;/Applications/xampp/xamppfiles/lib/php/php5/extensions/no-debug-non-zts-20060613/xdebug.soquot; xdebug.remote_enable=true xdebug.remote_host=127.0.0.1 ;if debugging on remote server, put client IP here xdebug.remote_port=9000 xdebug.remote_handler=dbgp ;; profiler xdebug.profiler_enable=Off xdebug.profiler_enable_trigger=On xdebug.profiler_output_dir=/data_lokal/temp/xdebug/profiling  or .htaccess - file #-------------------------------# # xDebug section # #-------------------------------# php_value xdebug.remote_enable 1 php_value xdebug.remote_handler bdgp php_value xdebug.remote_host 127.0.0.1 ;if debugging on remote server, put client IP here ;; php_value xdebug.allowed_clients <client IP address> php_value xdebug.remote_port 9000 # profiler php_value xdebug.profiler_enable_trigger 1 php_value xdebug.profiler_enable 0 php_value xdebug.profiler_output_dir quot;/data_lokal/temp/xdebug/profilingquot;
  25. 25. xDebug (III)  Debug dialog
  26. 26. xDebug (IV)  Configure PDT to talk to xDebug
  27. 27. xDebug (IV)  Configure the 'Server' handling the debugging session
  28. 28. Tips and Tricks (Configuration)  Heap space (memory allocated by JVM) size depends on system memory capacity ▹ Xms, Xmx ▹ XXMaxPermSize, XXPermSize  Eclipse PDT settings ▹ validation / build settings ▹ disable automatic updates ▹ disable code folding
  29. 29. Plugins  Subclipse managing SVN repositories from inside Eclipse  JSEclipse Provides additional features supporting JavaScript  Data Tools Platform managing databases from inside Eclipse
  30. 30. Subclipse (installation)  Eclipse update site: http://subclipse.tigris.org/update
  31. 31. Subclipse (configuration)  Set „auto-properties“ ▹ WinXp: C:Dokumente und Einstellungen<USER>AnwendungsdatenSubversionconfig ▹ MacOs / Linux: ~/.subversion/config [miscellany] global-ignores = *.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#* .DS_Store .project .cache .settings enable-auto-props = yes [auto-props] *.js = svn:eol-style=LF;svn:keywords=Id LastChangedDate LastChangedRevision URL *.css = svn:eol-style=LF;svn:keywords=Id LastChangedDate LastChangedRevision URL *.php = svn:eol-style=LF;svn:keywords=Id LastChangedDate LastChangedRevision URL *.html = svn:eol-style=LF;svn:mime-type=text/html;svn:keywords=LastChangedDate LastChangedRevision URL *.htm = svn:eol-style=LF;svn:mime-type=text/html;svn:keywords=LastChangedDate LastChangedRevision URL *.xsl = svn:eol-style=LF *.xml = svn:eol-style=LF *.xsd = svn:eol-style=LF
  32. 32. Subclipse (conflict handling)  Integrated (diff-) editor to resolve conflicts  Support for merging changes which do not conflict  Preview on the checkout to find conflicts before updating the sources
  33. 33. Questions? Further questions? Ask me at: lapistano@php.net
  34. 34. References  Eclipse PDT (http://www.eclipse.org/pdt)  Eclipse plugins ▹ Subclipse (http://subclipse.tigris.org) ▹ JSEclipse (http://www.interaktonline.com/products/eclipse/jseclipse/overview)  xDebug (http://www.xdebug.org)  PhpDocumentor @ pear.php.net (http://pear.php.net/package/PhpDocumentor/docs/1.4.2)  SVN keyword substitution (http://svnbook.red-bean.com/en/1.4/svn-book.html#svn.advanced.props.special.keywords)
  35. 35. License  This set of slides and the source code included in the download package is licensed under the Creative Commons Attribution- Noncommercial-Share Alike 2.0 Generic License http://creativecommons.org/licenses/by-nc-sa/2.0/deed.en

×