├── .gitignore ├── codeigniter-phpstorm.png ├── README.md └── phpstorm.php /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | -------------------------------------------------------------------------------- /codeigniter-phpstorm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natanfelles/codeigniter-phpstorm/HEAD/codeigniter-phpstorm.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PhpStorm Code Completion to CodeIgniter + HMVC 2 | 3 | Working perfectly with CodeIgniter 3.* 4 | 5 | ### How to use it: 6 | 7 | 1. Drop the **phpstorm.php** file into your CI project root then PhpStorm will index it. 8 | 2. Go to *system/core/* folder. 9 | 3. Select *Controller.php* and *Model.php* files, right click and set *Mark as Plain Text*. 10 | 11 | ### HMVC Support 12 | 13 | If you are using the Modular HMVC, mark as Plain Text the Controller.php file in the MX folder. 14 | 15 | You need to add the `@property` tag in the class doc block: 16 | 17 | ```php 18 | /** 19 | * Class Cart 20 | * @property Cart $cart Cart module 21 | */ 22 | class Cart extends MX_Controller { 23 | 24 | /** 25 | * Add product to cart 26 | * @param int $id Product id 27 | */ 28 | public function add($id = 0) 29 | { 30 | // Do it... 31 | } 32 | } 33 | ``` 34 | 35 | To load modules in other places do like it: 36 | 37 | ```php 38 | /** 39 | * @var Cart $cart This will provide Code Completion in the $cart variable 40 | */ 41 | $cart = Modules::load('cart'); 42 | ``` 43 | 44 | Use *Ctrl + Q* in `$cart` to load documentation or help with available functions: 45 | 46 | ```php 47 | $cart->add(5); 48 | ``` 49 | 50 | ### Usage in Views 51 | 52 | If you want load CI_Controller or MX_Controller in a view, add a doc block as follow: 53 | 54 | ```php 55 | /** 56 | * @var CI_Controller $this 57 | */ 58 | echo $this->uri->segment(1); 59 | ```` 60 | 61 | ### Preview: 62 | ![Image of Code Completion](https://raw.githubusercontent.com/natanfelles/codeigniter-phpstorm/master/codeigniter-phpstorm.png) 63 | 64 | -------------------------------------------------------------------------------- /phpstorm.php: -------------------------------------------------------------------------------- 1 |