HOWTO setup Eclipse 3.7 (Indigo) for CakePHP 1.3 development

Note: updated 9/9/11 for eclipse 3.7 (Indigo)

There are lots of great resources out there for developing CakePHP apps in eclipse – but they are outdated and scattered.  I took the time tonight to setup my environment, so I figured I’d blog about it.  Below are the steps I took to get thinks as I like ’em. I run Ubuntu 10.10 64bit, but these directions should apply to any OS.  This requires you have CakePHP 1.3.X extracted someplace on your box.

  1. Install Eclipse 3.7 (indigo). If your just gonna do PHP development, get the classic version.
  2. Help > install new software > work with: all available sites > search for PDT. Install PDT.
  3. Optional: Install Subversive if you use SVN, or install Egit if you use git/github. Subversive is available in default indigo eclipse repo. For Egit, i’d recomend using the http://download.eclipse.org/egit/updates repo.
  4. Setup your PATH to use the cake console (optional, requires php5-cli to be installed).  This allows you to call ‘cake bake help’ for example, from your terminal.  Edit ~/.profile and add to the bottom of the file
    PATH="/path/to/cake/runtime/13/cake/console:$PATH"
  5. Setup eclipse so it can run ‘cake bake directly’ from the IDE.
    1. Open eclipse, go to your PHP explorer perspective.  From the menu choose Run > External Tools > External Tools Configurations
    2. Click Program, then new program (white page upper left). Give it a name like Cake bake.
    3. In the Location field put the full path to the cake console script.  I have 1 shared runtime on my box for all my CakePHP 1.3 based apps. Ex: /opt/cake/runtime/13/cake/console/cake. Note: If you typically run diff versions of cake or have the cake runtime directly in your project, you can insert variables in the location box (like workspace).
    4. Under Working Directory put ${project_loc}/app
    5. Under Arguments put ‘bake’
    6. Now click Apply then close.
    7. Test it out by clicking on a cake project (must have the structure of ‘project name’ with a subfolder called ‘app’), then clicking Run>External tools>Cake bake.  This will open a console that you can type in.
  6. Repeat Step 5 for other cake console things you would like to use from the IDE (like ‘cake console’ for example)
  7. Setup syntax highlighting for .ctp files:
    1. Window > Preferences > General > Appearance > content Types > Text > PHP Content type > Add.. , then put in *.ctp.
  8. Install Open Cake File eclipse plugin to enable fast switching between your MVC classes/files. This is not well known, but its a nifty plugin.

 

Thats it! If you know of any other cool things email me, and I’ll add em. Note: I left off code completion intentionally, as I big fan of the implementation of the solutions I’ve seen.

Advertisement

3 thoughts on “HOWTO setup Eclipse 3.7 (Indigo) for CakePHP 1.3 development

  1. Your blog is very useful thanks for the information.I am currently using eclipse Helios version and when I right click on the project I do not get the "configure include path" any Idea where it is or how should I proceed to configure the include path so i can get the code completion with Cakephp lib.I am new to eclipse, I am looking forward to use this tool, i heard a lot about it.I use fedora 14 as OS and trying to link eclipse to cakephp.Thank you in ad vance for your help.Abhi

  2. I know you don’t mention using "configure include path", I still can’t find it.It seems it is important to get the code completion. I read this article: http://bakery.cakephp.org/articles/MilkyJoe/2007/08/14/setting-up-eclipse-to-work-with-cake

  3. Hmm not quite sure what is going on. You may want to contact Milky Joe.  As i say in my post, I do not mess with code completion as I do not like the options that are currently out there (cause problems like this).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this:
search previous next tag category expand menu location phone mail time cart zoom edit close