How to Use Code Hinting in PHPStorm for Codeigniter

How to Use Code Hinting in PHPStorm for Codeigniter

PHPStorm doesn't show code hinting for Codeigniter classes by default. We can do it with a little efforts. Follow these simple steps to achieve it:

  • Step1: Open a Codeigniter Project in PHPStorm and open a controller class in the editor. For example if we have a Controller class named Events open Events.php form controllers folder in editor (also we have a Model Class Events_Model from which we need to show code hinting inside controller class).
  • Step 2: Put a class documentation comment at the top of the class declaration like this with @property :
/**
 * Class Events
 * @property Events_Model $events_model
 */
  • Step 3. Now go to any method of the controller class and start typing Model's method calling in Codeigniter's way :
$this->data['events'] = $this->events_model->get_events();

 you can put  @property tags inside comments block  for all the models you have in your Codeigniter project and the hinting for those models' methods will be shown inside the editor.

Tags
PhpStorm
Share this Post