Extension Examples

For developers' convenience, we have created several extension examples. They might help you understand how to develop certain functionality. Before implementing certain aspects of an extension, we recommend that you familiarize yourself with examples and their code. A task that you need to accomplish might be a typical one, and there is a chance that there is a ready implementation example that will help you speed up development.

The extension examples can be found on our GitHub page. You can install them into Plesk by using the Plesk administrator's interface.

In this chapter:

Example 1. Panel Stats

Example 2. Panel News

Example 3. Requests Tracker

Example 4. Test Extension

 

Example 1. Panel Stats

The ext-panel-stats extension enables external or third-party systems to retrieve statistics about Plesk usage. It is possible to retrieve data at a special URL. The data include information about the number of subscriptions, domains, customers, and resellers. The information can be presented in various formats. This extension can be useful for integration with external monitoring and statistics calculation systems.

The following techniques are demonstrated:

  • Provision of information.
  • Authentication mechanism.
  • The use of the XML API to retrieve statistical data.
  • The use of a key-value storage for keeping the extension's settings.
  • Creation and processing of a page with a settings form.
  • Generation of default settings in the post-install script.
 

Example 2. Panel News

The ext-panel-news extension is a widget for the administrator's Home page in Plesk. It shows the latest news about Plesk (based on an RSS channel). The RSS feed is updated daily.

The following techniques are demonstrated:

  • Addition of a widget to the administrator's Home page.
  • Periodic data update based on a task scheduler.
  • The use of a key-value storage for keeping the extension's data.
  • Retrieval of initial data in the post-install script and task scheduling.
 

Example 3. Requests Tracker

The ext-rmsp extension adds a request tracking system, which customers can use to file requests to the Plesk administrator. The administrator can comment on request tickets and close them.

The following techniques are demonstrated:

  • Creation of a web interface for an extension.
  • Addition of buttons for the administrator and customers.
  • Rendering of different interfaces for the administrator and customers.
  • The use of the post-install script.
  • The use of an SQLite database for storing information.
 

Example 4. Test Extension

The ext-example extension is a test extension intended to demonstrate various aspects of using the API.

The following techniques are demonstrated:

  • Creation of a custom button in the post-install script.
  • Creation of an interface by using MVC.
  • Creation of a form.

There are a number of other sample extensions available in our GitHub repository here. Look for the repositories with the ext- prefix, for example, ext-embed-js.

 

Leave your feedback on this topic here

If you have questions or need support, please visit the Plesk forum or contact your hosting provider.
The comments below are for feedback on the documentation only. No timely answers or help will be provided.