Autocomplete |
Hi everyone,
I am new to this forum. I am currently checking for myself what kind of FW I am going to use for my next project. This far Ive been checking Zend 2, Cake 3, Laravel and some smaller FWs. To my liking and previous experience with CI, CI3 is still damn easy to handle. Thats really nice, especially if you compare it to "younger upstarts" that tend to do a lot of "magic" behind the scenes with ORMs, getters, setters, huge config files and what not. There is however one huge drawback. The way CI3 loads its components (lets say encryption for example) my IDE does not offer me autocompletion. This far Ive found some kind of hack for Netbeans and a small plugin, which sadly seems to be dropped from developement and seemingly was meant to build CRUD and MVC Skeletons. It would be really great if autocompletion would not only work with core classes/objects, but with models as well. Currently I need to quickjump into the model and check the syntax of the method I want to use. That is a huge drag and might be a reason for not using CI3. My search came up with the two solutions above, which arent really solutions. Am I missing some other way ? My System: MacOS 10.11 Netbeans 8.0.2 Best Regards, Marlon.
I personally recommend PHPStorm (paid / has trial version).
There is helper https://github.com/topdown/phpStorm-CC-Helpers for CodeIgniter AutoLoad which you can add to have autocompleting.. Its a lot faster than NetBeans .. (Mac OS + brew installed server Apache|Mysql|PHP) Best VPS Hosting : Digital Ocean
Thank you for your hint.
The plugin for PHPStorm does basically the same like the one for Netbeans. It helps the IDE indexing classes via a @property doc. This is helpful indeed, but needs a manual setup every time I create a new model. It might be possible to write a small command line script autofetching all models and adding them to the file. Ill try that tommorow. A cronjob should then do the trick.
hi -- just been learning phpstorm -- here is something that i'm still working through and is kind of crude but will autoload everything related to codeigniter in your controllers and models. This version is specifically for Codeigniter 3.
this will make available all codeigniter Libraries etc show up in code autocomplete when working in your controllers and models. and Phpstorm will not show a warning error for those methods because it will recognize them. in the application/config directory create a file called autocomplete.php sample contents are below to make your appliction model methods available, fill in the names of your models. there is People, Places, Things sample in there. PHP Code: <?php defined('BASEPATH') OR exit('No direct script access allowed'); theres probably more for the database, and this breaks it out separately -- so everything for controller, and then everything for the model, which is crude. seeing my models come up in autocomplete -- and then my model methods, got me like you can get phpstorm 9 for 30 day free trial. AND they have an "early access" program thats free as well, and ongoing. https://confluence.jetbrains.com/display...ss+Program i'm still just learning it, but wow - code clean up, refactoring tools, integrated ftp, create remote files on server, full git & version control, debugging, an HTTP client, database tool, easy integration with mamp, wamp, etc. and for an ide its pretty fast as well.
Yes models are a little bit shit as there is no real CI pluginfor PHP Storm.
How ever you are able to defina your models same wau as are defined the others libs.. Its some manual job but until there is a real plugin this is it. Best VPS Hosting : Digital Ocean
(10-19-2015, 11:08 PM)sv3tli0 Wrote: Yes models are a little bit shit as there is no real CI pluginfor PHP Storm. Ive written a controller which can be used in CI3 to take care of that. Either start it from hand, or use a cronjob. It rewrites the file "my_models.php" provided in your github link. Should work in PHPStorm as well, it definitly is in Netbeans. https://github.com/MarlonSchultz/CodeIgn...ete-Models Its quick and dirty, but does the job. No error handling involved. I dont know if others might find this useful, but I guess so.
Marlon this looks very cool will check it out. but please note that the Jeff Behnke version is for Codeigniter 2, not 3.
Hello Cartalot,
you are right. Ill change the readme. It should however work anyhow. Do you have your files on Github ? I could link you or fork your repo for further reference, or add your file above to my repo. Which however did not work for my models in Netbeans. I am guessing this is a property inheritance thing. I would need to check this. Feel free to use my code as you wish.
Come to think about it. My snippet could be easily changed to cover all the files in CI3. It just need to browse the files and then add them to a autocomplete file, like yours.
hey please do what you will with the code i posted -- this was a very quick solution cobbled together from other solutions just to get me up and running for testing out phpstorm to make sure i could get it working.
HOWEVER i did label the libs as to which are deprecated in CI 3, which are core, which are for the database, etc. so i think thats perhaps a good pattern because it gives everyone a quick overview of what to expect for the code complete, and where to find the classes in the system files. also i think for the db in ci 3 it needs to be @property CI_DB_query_builder $db because its not called active record any longer. and there has to be some clever solution for accessing result methods from a query. also i saw one recent solution on github where they did it as a helper, i didn't try it out but maybe there are advantages versus an autocomplete config file. https://github.com/wenpeng/CodeIgniter-PhpStorm-Helper |
Welcome Guest, Not a member yet? Register Sign In |