PHP

Setting up PHPDesigner for CakePHP

There are many great IDEs for PHP development.
One is PHPDesigner, which is mainly for windows.

With some minor adjustments it works pretty well with cake.

Preferences

Go to: Tools -> Preferences [CTRL + E]

  • General

    • File Encoding: UTF8
    • Trim on save: Trim Right (no need to save empty spaces to the right)
    • Detect Changes: Yes (very useful!)
    • Sublink -> Document Types: Add *.ctp to PHP
  • Editor

    • Tabs: YES (we want to use one tab as indend)
    • Tabs to spaces: NO (should not be converted)
    • Tab Width: 2 (so one tab will be 2 spaces wide)
  • Debugger

    • Syntax Check: I like to use a little bit different color here (a brighter red).

Those are just the most important ones. You can play with other settings, as well.

Project Setup

Go to: Project -> Project Manager [F11]

  • New => Add "Title" => Select "Root Folder" (should be your app directory!)
  • => Add "Libraries" (I usually add the cake folder, but you could also add the vendors folder here)
  • => Just hit "Next" until it’s finished.
  • You can now open the project. After a few seconds/minutes all functions are indexed and can be looked up with "Rightclick -> Go to declaration".

All PHP-internal functions can be looked up with F1 (Quick lookup in the PHP Manual).

To read more about code completion, see my other article about it.
It describes how you can use a shell script to dump all components, helpers, … into one "dummy" file to help PHPDesigner index and auto-complete all library functions.

Here is one example of how all cake and app functions get auto-completed and displayed:

Final Tips

Sometimes the files you open are still ANSI. If you add UTF8-Signs save it as UTF8 in order to display them correctly. Otherwise it will either be nonsense or nothing at all.
After editing or creating Projects you need to properly close and restart your editor. Otherwise changes might be lost after the next restart. This is some bug of PHPEditor, I guess.

PHPDesigner and Linux

The best of all IDEs is nativly only available for Windows.
For all those poor rats out there that use Linux:
www.zephid.dk/2008/07/01/using-phpdesigner-under-linux/
Seems to work (if you believe the comments).

0.00 avg. rating (0% score) - 0 votes

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.