A development process should be comfortable. It means that you should have an editor or an IDE that allows you to express your thoughts in a fast and easy manner. Of course, the editor or the IDE requires fine-tuning. If you are working on a new extension for Plesk, I suggest to take a look at PhpStorm. It’s a great IDE by JetBrains for PHP-based projects. Good news are that PhpStorm has a 30-days trial and you can try it for free. Out of the box PhpStorm does not know anything about Plesk extensions. And we’ll try to do the development of Plesk extensions a little bit more comfortable.
The first step is to checkout the API stubs repository. It’s located at https://github.com/plesk/pm-api-stubs Plesk Extensions API stubs is a set of files with all classes definitions and methods prototypes, but without implementation of these methods. You need to check out stubs to a separate directory (do not mix with extension’s source code). Later you can use these stubs for all extension projects you’ve started. If you have no Git client for checkout, download a zip archive and unpack it – https://github.com/plesk/pm-api-stubs/archive/master.zip
Next step is to configure an IDE to include the stubs as an external library. In case of PhpStorm you need to open left navigation, call the context menu on “External Libraries” item and select “Configure PHP Include Paths”:
Use a small “plus” sign at the bottom of the dialog to add a new “include path” with API stubs:
Now, if you open a file with source code and start typing the code, completion of API methods and classes will start working:
Internally Plesk uses Zend Framework. Plesk extensions also rely on Zend Framework components. It’s good idea to add Zend Framework code to an “include path” too. Download Zend Framework v.1.11.14, unpack it and add as the “include path” the same way as for the API stubs.
The repository https://github.com/plesk/pm-api-stubs contains API stubs for latest released Plesk version. Now, it’s Plesk 12.0. API stubs for older versions are placed in separate branches:
So, with proper completion support life became a little easy 🙂 There is no more need to check API documentation at every step.
If by some reason you missed the previous article about how to set up a development environment for creation of extensions, here is the link.
Alexei has been part of the Plesk team since 2005 and is the Plesk Core team's Unit Manager. He's passionate about programming, product development and driving tech teams.
Extensions: IDE and APIs Hinting2014-11-102017-09-04https://www.plesk.com/wp-content/themes/plesk/images/plesk_logo_144x144_black.pngPleskhttps://www.plesk.com/wp-content/uploads/2014/11/blog_ide.png200px200px