Extensions: IDE and APIs Hinting

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.

No comment yet, add your voice below!

Add a Comment

Your email address will not be published. Required fields are marked *

GET LATEST NEWS AND TIPS

  • Yes, please, I agree to receiving my personal Plesk Newsletter! WebPros International GmbH and other WebPros group companies may store and process the data I provide for the purpose of delivering the newsletter according to the WebPros Privacy Policy. In order to tailor its offerings to me, Plesk may further use additional information like usage and behavior data (Profiling). I can unsubscribe from the newsletter at any time by sending an email to [email protected] or use the unsubscribe link in any of the newsletters.

  • Hidden
  • Hidden
  • Hidden
  • Hidden
  • Hidden
  • Hidden

Related Posts

Knowledge Base

Plesk uses LiveChat system (3rd party).

By proceeding below, I hereby agree to use LiveChat as an external third party technology. This may involve a transfer of my personal data (e.g. IP Address) to third parties in- or outside of Europe. For more information, please see our Privacy Policy.

Search
Generic filters
Exact matches only
Search in title
Search in content
Search in excerpt