Introduction

About Plesk Extensions

A Plesk extension, as the name suggests, is a third-party software that adds new functionality to Plesk. The former name of Plesk extensions is modules. Typical examples of extensions are help desk and ticket system solutions. On one hand, these solutions access information about Plesk entities, particularly, user accounts, and on the other hand they provide their own tools to help administrators and customers communicate with each other.

Extensions are written in PHP and their organization reuses Zend framework practices to a large extent, for example, the implementation of MVC and forms construction. Using these practices is recommended, but is not required. Because PHP is mandatory for writing extensions, we assume that the readers of this document have knowledge of the programming language. If you haven't written PHP applications before, you can still use the document, but you might need to read some PHP-specific topics (which are beyond the document scope) to develop the extension you need.

How to Create and Install Extensions

A ready for distribution extension is a ZIP archive which contains a specifically-organized directory structure and a file with meta information describing the software. A fast way to create an extension is to call the extension command-line utility (extension --create <EXTENSION_NAME>). This call will create the necessary file structure. Read more about organization of extension files in Extension Structure.

Extensions are normally installed by the administrator in Plesk, in Server Management > Extensions (in the left navigation menu).

Extensions Management Utility

The extension command-line utility enables you to manage extensions through the command-line interface, including installation or removing of extensions, packing the source files of an extension into a ZIP archive ready for distribution, and generating an extension template. Learn how to use the extensions utility.

Get Started with Extensions Development

The most rapid way to start developing extensions is to read the Quick Start chapter. This chapter guides you through the process of developing simple extensions and provides concrete examples of using Plesk features in combination with conceptual information and best practices of how to work with the SDK.

Extension Examples

We provide examples of implementation of certain extensions, such as RSS news or requests tracking system. You can learn from the examples and use their code when developing custom extensions for Plesk. Learn more.

API Stubs

For quicker development, you can use API stubs for IDE, which are available at https://github.com/plesk/pm-api-stubs. Download the files and add them to your IDE. For example, if you use PhpStorm, go to Project Settings > PHP and add the directory with the downloaded files in Include Path.

Plesk Features Available to Extensions

An extension can receive information about Plesk entities, react to different system events, and do even more through Plesk interfaces. The full list of available interfaces is as follows:

  • Getting user and domain data.

    This interface enables extensions to retrieve information about Plesk users and hosted domains. Particularly, this interface can be used for establishing context of the user currently logged in to Plesk and the domain that is open in the Control Panel. Learn how to use this interface.

  • XML API.

    This interface allows extensions to get administrative control over Plesk entities and manage them by exchanging operation requests wrapped into XML-structured packets. Plesk receives such an XML-structured operation request, processes it, and responds with a PHP class whose fields mimic the XML tree structure. A Plesk response includes an operation status and operation-related details. For example, if you request information about a customer account, the account details will be returned. Read how to use this interface.

  • Command-line interface (CLI).

    This interface allows extensions to perform operations on Plesk objects from the command line on behalf of the administrator. Read how to use this interface.

  • Key-value storage.

    Extensions can put some of their persistent data, for example, their settings in the key-value storage (provided by Plesk) and then easily get the data on demand. Read how to use this interface.

  • Event handlers.

    This interface lets extensions subscribe to a particular Plesk event and trigger a particular action depending on the event information. Read how to use this interface.

  • Scheduled tasks.

    Using this interface, extensions can run periodic tasks, for example, to collect daily statistics or analyze data. Read how to use this interface.

  • Rendering UI elements.

    This interface offers means of generating UI elements, such as links, lists, messages, buttons, and tabs, by using controller and view helpers. Read how to use this interface.

  • File manager.

    Using this interface, extensions can read and edit files and directories on the server and extend the Plesk File Manager's functionality. Read how to use this interface.

  • Home widget.

    Using this interface, extensions can advertise themselves by adding promotional blocks to the Administrator's dashboard (the Home page). Read how to use this interface.

  • Global JavaScript and CSS files.

    Using these files, extensions can adjust the functionality and appearance of existing Plesk pages, all at once or only selected ones. Read how to use this interface.

  • Content include hook.

    This interface provides a way to generate HTML or JavaScript code to be included into Plesk pages. Read how to use this interface.

  • Authentication hook.

    Using this hook, extensions can check user credentials in an external system. Read how to use this interface.

  • Custom buttons.

    Plesk provides an easy way to add custom buttons related to an extension. Read how to use this interface.

  • Localization.

    Extensions can automatically display their messages in the language selected in Plesk. Read how to use this interface.

  • Mail handlers.

    This interface allows invocation of custom mail handlers at various stages of mail processing by the Mail Transfer Agent (MTA) to manage incoming, outgoing, and pass-through mail. Read how to use this interface.

  • Third-party DNS.

    Plesk provides the option to use external third-party DNS servers to resolve domain names of websites hosted on the Plesk server. Read how to use this interface.

  • Slave DNS server.

    Plesk provides means of integrating Plesk with an external Linux-based slave DNS server. Read how to use this interface.

Testing Extensions

In order to test an extension, you should install it to Plesk. To provide you with more debugging information, we recommend that you increase the verbosity of the debugging information in Plesk. Learn how to test extensions.

Resources and Further Learning

This document covers only the basic functionality that the SDK provides. To view a complete list of Plesk tools that an extension can use, read the auto-generated Reference document and review the extension samples.

Additionally, for learning purposes, you can use existing Plesk extensions available on our GitHub page. See also the Extension Examples section of this guide.