Any chance of an updated version of this post for CakePHP 2.1 and recent versions of Eclipse? The techniques here do not seem to work for me.

Justin on 5/5/12

Justin: I’m sure there’s a way to do it, however I haven’t used eclipse in ~2.5 years. But I’m sure someone who knows eclipse better than I could figure it out :)

mark story on 5/5/12

Hi, guys.

Here goes my contribution for using CakePHP 2.1.3 (at this moment :P ) in Eclipse (I use PDT as mentioned by Mark).

For completion in Controllers (using Model methods), add this at the begging of each controller file
<?php
/** * @property ModelName $ModelName */

rest of controller
?>

For completion in Views(using Helpers methods), add this at the begging of each view file
/* @var $this View */ --represents the own view, dont change "View", it will load helpers when you type $this->Ctrl+Space
?>

I didnt find any way to get, in the views, the variables created in controllers =( If anyone find it out, pleeeeeeeeeeease, share =) Another thing, I dont know… how to debug in Eclipse. Can someone explain or post a link with the step by step

And, here, something I found useful too… http://phpdev.ro/netbeans-and-cakephp-the-code-completition.html (explaining something about associations)

Cya

Julian on 5/28/12

Hi, guys.

Here goes my contribution for using CakePHP 2.1.3 (at this moment :P ) in Eclipse (I use PDT as mentioned by Mark).

For completion in Controllers (using Model methods), add this at the begging of each controller file
<?php
/** * @property ModelName $ModelName */

rest of controller
?>

For completion in Views(using Helpers methods), add this at the begging of each view file
/* @var $this View */ --represents the own view, dont change "View", it will load helpers when you type $this->Ctrl+Space
?>

I didnt find any way to get, in the views, the variables created in controllers =( If anyone find it out, pleeeeeeeeeeease, share =) Another thing, I dont know… how to debug in Eclipse. Can someone explain or post a link with the step by step

And, here, something I found useful too… http://phpdev.ro/netbeans-and-cakephp-the-code-completition.html (explaining something about associations)

Cya

Julian on 5/28/12

How can I use custom helpers inside ctp files?
This didn’t work:

  • @property Myelegant $MyelegantHelper

I tried this also: * @var $Myelegant MyelegantHelper
It gives for $Myelegant->
but inside ctp file I need
$this->Myelegant->

I would be very happy if you can help.

danny on 6/4/13

I use and suggest Codelobster PHP Edition – http://www.codelobster.com
it has special plugin for CakePHP autocomplete.

Stas on 6/20/13

For view helper, I do this:
1. Create the autocomplete.php anywhere in /app with content like this (remove the if(false)):

exit();
//Add in some helpers so the code assist works much better.
// if(false) { $ajax = new AjaxHelper(); $html = new HtmlHelper(); $form = new FormHelper(); $javascript = new JavascriptHelper(); $number = new NumberHelper(); $session = new SessionHelper(); $text = new TextHelper(); $time = new TimeHelper(); $pagination = new PaginationHelper(); $rss = new RssHelper(); $xml = new XmlHelper();
// }
?>

2. then in each of ctp file, I do this (example for $this->Html):
$html = $this->Html

This way, later in same ctp file, you can just use $html and it will show suggestion.

I’m using CakePHP 2.4.1 and Eclipse Kepler

ngo_bakabon on 9/17/13

Could we get an updated version of this for CakePHP 3

I know this isn’t Cake specific but there doesn’t seem to be good documentation for Eclipse PHP autocomplete comments.

Paul West on 12/16/15

Paul West: I’ve not used eclipse is many many years so I don’t think I would be a good person to provide updated code completion tooling.

mark story on 12/19/15