I received an early access from Zend for the release of Zend Studio 12.5 so I decided to test it !
What's Zend Studio ?
Zend Studio is the Zend IDE, it is based on Eclipse IDE and it's specialized for PHP developers. This editor provides a lot of little features that make your life easier as PHP developer. Like others IDE as Eclipse or Netbeans the basic functions are present, git management, possibility to put a theme for the editor, database management, auto completion, refactoring, etc...
Coupled with Zend Server, the IDE will allow you to debug "step by step" or to profile your PHP application so you can easily fix bugs or performance problems. you can also enjoy "Apigility", "Zend on the go", or deploying in the cloud... for these parts I let you discover the editor on the Zend website (www.zend.com
Zend Studio also allows you to add functionality via plugins or templates.
In this tutorial, we will add two functionalities to work with Magento:
- The "magento plugin" will allows you to add auto completion this the type of call "Mage::getModel('catalog/product')"
- The "magento snippets" will allows you to add code templates used to generate magento "skeleton code".
Specific auto complete for "magento"
If you used another editor like me for a long time you probably know that PHP for auto completion, in general it is perfectly managed. The problem happens with magento because the publisher does not understand magento "factory" method. As soon as we made a Mage::getModel('catalog / product') for example, finished ! no more autocomplete...
So dificult for a beginner developer to know the methods he should use. So the must browse the core code of Magento, go to the model concerned and view the available functions ... it's a bit old school now ;) So a more modern way to do this is to install a plugin that will allow your editor to understand such features.
Sylvain Rayé wrote a tutorial on this subject in May 2012, the plugin does not seem to have changed much since then so I will not repeat all the details of his article, go read the article about eclipse magento plugin on his blog www.sylvainraye.com
you will find plenty of other good articles.
To download the plugin here it is:
Then click Help> Install Software, Add add the url by giving it a name. Then, you will see the plugin in the list just below, turn on and you're done!
Go to one of your files and make sure the auto completion work properly.
The auto completion is good but magento developement is made (more or less) of doing always the same things ! Declaring a model for example is always the same. To do this, we will add a series of skeleton templates in our editor. Then we will type a text command in the editor to use the template system. The command text will be replaced by the generated code !
To download the plugin here it is:
Debugging a magento application with Zend Studio and Zend Server
The advantage of working with Zend Studio is also to be able to debug and profile our application with Zend Server directly into the editor.
Zend Studio automatically recognizes Zend Server is installed on your machine, so you'll be able to connect it at the creation of your project in the editor.
Once linked to Zend Server, you can profile your application and use Z-Ray.The debugger:
This debugger is a "step by step" which allows you to set breakpoints to see what happens in your variables when executing your scripts. This system will help you identify the origin of a anomaly (more or less like using Xdebug).
is a tool that allows you to see the php call stack of your page and have the information on to consumption of each function called in your script (equivalent to xhprof).
It is also the first video in the YouTube channel, be gentle I'm not very used to do this kind of tutorial for the moment but i'm working on it ;) Be careful to watch HD video to see properly all lines of code and to activate english subtitles.
Well, at first i was not used to Zend environment to debug. I got looked when I saw appear Z-Ray for the first tutorial and I found it really convenient and rather well done. What's about you?