2017 © Pedro Peláez
 

library codeigniter-phpstorm

PhpStorm Code Completion to CodeIgniter + HMVC

image

muraveiko/codeigniter-phpstorm

PhpStorm Code Completion to CodeIgniter + HMVC

  • Monday, March 13, 2017
  • by Muraveiko
  • Repository
  • 2 Watchers
  • 0 Stars
  • 67 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 74 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

PhpStorm Code Completion to CodeIgniter + HMVC

Fixed code complemention for use MY_Controller & MY_Model.
Also solved issue https://github.com/natanfelles/codeigniter-phpstorm/issues/9, (*1)

Working perfectly with CodeIgniter 3.*, (*2)

How to use it:

  1. composer require muraveiko/codeigniter-phpstorm --dev
  2. & 3. analogue original

How to use it (original):

  1. Drop the phpstorm.php file into your CI project root then PhpStorm will index it.
  2. Go to system/core/ folder.
  3. Select Controller.php and Model.php files, right click and set Mark as Plain Text.

HMVC Support

If you are using the Modular HMVC, mark as Plain Text the Controller.php file in the MX folder., (*3)

You need to add the @property tag in the class doc block:, (*4)

/**
 * Class Cart
 * @property Cart $cart Cart module
 */
class Cart extends MX_Controller {

    /**
     * Add product to cart
     * @param int $id Product id
     */
    public function add($id = 0)
    {
        // Do it...
    }
}

To load modules in other places do like it:, (*5)

/**
 * @var Cart $cart This will provide Code Completion in the $cart variable
 */
$cart = Modules::load('cart');

Use Ctrl + Q in $cart to load documentation or help with available functions:, (*6)

$cart->add(5);

Usage in Views

If you want load CI_Controller or MX_Controller in a view, add a doc block as follow:, (*7)

```php /** * @var CI_Controller $this */ echo $this->uri->segment(1); ````, (*8)

Preview:

Image of Code Completion, (*9)

The Versions

13/03 2017

dev-master

9999999-dev

PhpStorm Code Completion to CodeIgniter + HMVC

  Sources   Download

MIT

by Oleg Muraveyko