Reputation: 6150
Magento has a large code base (6000+ php files), uses a complex autoloading logic, and has a lot of configuration in XML. I'm looking for an IDE that can get its little brain around this code base - show me where a function is declared, where it's called, etc. Is there any IDE that can handle this beast?
EDIT - Adding examples
Here's an example of how to load a product the Magento way:
$product = Mage::getModel('catalog/product')->load($productID)
Getting a helper class looks similar:
$helper = Mage::getHelper('catalog/product')
Additionally, the getters and setters of attributes are often assumed from the model, which may very well have been declared in an XML file somewhere, rather than in code.
Upvotes: 11
Views: 11240
Reputation: 144
Using what @Laizer sad, Vinai created a shell script that generates that class map that PhpStorm knows to read and autocomplete functions and classes.
See the git repository: https://github.com/Vinai/phpstorm-magento-mapper
Upvotes: 1
Reputation: 29
Look this extension fo PHPSTORM IDE. I do use this and is very good.
Upvotes: 2
Reputation: 6150
JetBrains just released a version of PHPStorm that addresses the factory methods in Magento. http://blog.jetbrains.com/webide/2013/04/phpstorm-6-0-1-eap-build-129-177/ http://confluence.jetbrains.com/display/PhpStorm/PhpStorm+Advanced+Metadata
Upvotes: 1
Reputation: 4833
I've developed an open source plugin for PHPStorm, maybe you want to take a look: http://www.magicento.com
The plugin can handle what you are asking for and also has more features, like autocomplete in xml files. I will add more features every week, because I use the plugin in my everyday work. I hope it becomes useful for you too.
Upvotes: 10
Reputation: 31
Try Magento Plugin for Eclipse based IDE's that can handle Magento instantiate of objects (like Mage::helper('helper'), Mage::getModels('module/model'), etc).
http://code.google.com/p/magento-plugin
Upvotes: 3
Reputation: 2215
I've found that using any flavor of Eclipse (Aptana, PDT, or Zend), and making good use of documentation features like the /* @var ... */ comment does wonders.
For example, if I am working on a custom module called Strube_MyModule with the following structure:
Strube\ MyModule\ Block\ Custom.php template\ mymodule\ custom.phtml
Strube\MyModule\Blocks\Custom.php
<?php
class Strube_MyModule_Block_Custom extend Mage_Core_Block_Template {
public function _construct() {
$this->setTemplate('../../../../path/to/template/mymodule/custom.phtml');
}
/**
* Eclipse is smart enough to follow PHP-Docs
*
* @return Mage_Customer_Model_Customer
*/
public function getCustomer() {
return Mage::getSingleton('customer/session')->getCustomer();
}
}
template\mymodule\custom.phtml
<?php
/**
* PHP DOC!
*/
/* @var $this Strube_MyModule_Block_Custom */
// Now you can auto-complete $this->...
// You can also <ctrl> + click on functions that descent from $this
echo $this->getChildHtml();
// It will also autocomplete based on PHP-doc @return tags
echo $this->getCustomer()->getName();
Upvotes: 2
Reputation: 3258
A Netbeans fan myself. What you are looking for is Class Type Hints that both Zend Studio and Nebeans support. Magento has been slow in setting these, but there are some occasions of it in the code.
http://files.zend.com/help/Zend-Studio-7/code_assist_concept.htm
/* @var $myVar TestClass */ $myVar = new getClass();
Upvotes: 13
Reputation: 27119
Probably not the answer you want, but the number of files probably won't be your foil here. Since Magento uses strange methods to instantiate objects (Mage::getModel
etc), normal code completion is completely at a loss. On top of that, Magento makes heavy use of PHP's magic functions, which of course are totally exempt from code completion.
I've worked with a few IDEs using Magento (Komodo, Zend Studio, Eclipse), and I've never had a very good result. Komodo was the only one that didn't have a coronary trying to guess, so I've been using that for some time now.
Hope that helps. Thanks!
Joe
Upvotes: 14
Reputation: 532
If you are going for a free IDE, then Eclipse PDT will work just fine. It can handle all those files without problem. If you want a more full-featured IDE, I would choose Zend Studio. Zend Studio is essentially Eclipse PDT with additional features (like a really nice debugger/profiler built into a browser toolbar, and better code formatting out of the box).
Upvotes: 7
Reputation: 1118
I've used Netbeans to work on large PHP projects (it also handles large Java and C projects). My current CakePHP projects has 35000 files, 4000-5000 of them are PHP files including external libraries etc.
The IDE is responsive for some time, but if you keep it running overnight the IDE becomes sluggish and you need to restart it.
Upvotes: 1
Reputation: 449783
This is going to be down to two factors: IDE smartness (Is it going to recognize all the autoloaded classes?) and plain performance (How long does it take the IDE to walk through the file tree to build a lookup lexicon? How often is it going to refresh?)
Whether an IDE can handle those amounts of files depends strongly on how your machine is equipped. I recommend you go through the trial versions of the most popular PHP IDE's, and look which one suits you best. It should be quite easy to find out whether you can work with them or not.
I for one work with Nusphere's phpEd (14-day Trial here). I have never worked with that large a project, but big ones and I'm satisfied with the code lookup functionality. Like probably most IDE's, it allows manual addition of includes in case it misses an autoload.
Then there's Zend Studio (Download here) and Eclipse PDT (here), and a whole lot more to look at in this question. Not all of them do Code Completion for PHP, so you'll have to pick out those that do.
Upvotes: 6