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 and install an extension is to call the
extension command-line utility (learn more in Extensions Management Utility). The main steps are described below.
Step 1. Creation of a new Plesk extension can be started from generating a new stub - a set of files that are necessary for a new extension. To do this, log in to a machine with Plesk installation and type the following command:
plesk bin extension --create <EXTENSION_NAME>
<EXTENSION_NAME> should be replaced with the name of the extension. For example:
plesk bin extension --create my_extension
This command will create a new extension named
my_extension. It will also provide information about where extension parts are located on the file system.
Step 2. The next step is to register the extension in Plesk. Run the following command:
plesk bin extension --register my_extension
As a result, the new extension will be displayed in the list of extensions on the Extensions page of the Plesk user interface:
Step 3. Now you have to pack all the parts of extension into a ZIP archive ready for installation. Run the following command:
plesk bin extension --pack my_extension
This call will create a package with the necessary file structure. Read more about organization of extension files in Extension Structure.
Step 4. Now you can update the extensions files as necessary. Refer to other sections of this guide to learn how to develop extensions. For quicker development, it is recommended to use API Stubs.
Note: You can continue the development on the machine where Plesk is installed, but a more common way is to develop on you own machine and sync the source code with the Plesk installation on a regular manner. Find more details in the Plesk developer blog article: Extensions: Development Environment.
Step 5. When you have finished the development, install your extension. You can do so via the Plesk interface or using the CLI commands.
To install an extension from a file via the Plesk interface:
- Add the following lines to the
extensionUpload = true
- Click Extensions and go to My Extensions.
- Click Upload Extension. Select the file containing the packaged extension you developed, and click OK.
To install an extension from a file, use the following command:
plesk bin extension -i <EXTENSION_PATH>
<EXTENSION_PATH> should be replaced with the path to the extension ZIP archive. For example:
plesk bin extension -i C:\Users\Administrator\my_extension-1.0-1.zip
Each time you update your extension files, upload the archive again, and all the changes will be applied to your extension.