Plesk Extensions: Development Environment

Plesk Extensions: Development Environment

This article describes how to setup a development environment for creation of Plesk extensions.

Creation of a new Plesk extension can be started from generating a new stub. To do this log in to a machine with Plesk installation and type the following command:

Here is an example of output:

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.

The next step is to register the extension in Plesk:

After that, the extension should appear in the list of extensions in Plesk UI:

Plesk Extensions Management

It is possible to continue the development on the machine where Plesk is installed. But more common way is to develop on you own machine and sync the source code with the Plesk installation on a regular manner.

To start the development on your own machine (instead of the machine with Plesk installation) you need to obtain the source code of the extension. This can be done by creating a package and transferring it to your development machine. To create a package, do the following on the machine with the Plesk installation:

Copy the created ZIP archive to your machine. For example, by using this command:

Create a directory for the extension on your machine. For example, “my-extension”. Extract the contents of the archive there. The directory structure should look as follows:

Once you have a directory with extension contents you can start editing the source code using your favorite  editor. PhpStorm is highly recommended for this purpose.

The next step is to sync the source code with the Plesk installation after code changes. PhpStorm allows to set up files upload to remote server (some other IDEs also provide this option). To set up files upload, go to Tools > Deployment > Configuration, and add a new server:

Plesk Extensions: Deployment

Also, set up  the mapping of directories because the directories layout on the development machine and on the Plesk installation is different. Here is an example:

Plesk Extensions: mapping of directories

After that you can upload files to a remote server by clicking Tools > Deployment > Upload to your-server.dom  PhpStorm also provides an option for automatic files upload. Select Tools > Deployment > Automatic Upload and PhpStorm will re-upload files every time a file is created or modified in the IDE.

If you prefer to edit files in VI or another editor that does not provide the option for uploading files to remote servers, you can use the following script published on GitHub:

To use this script you need to have rsync installed and put your SSH key on the destination machine to avoid re-typing of the password on every synchronization.


    • Jay Versluis

      Hi Alexei,

      Great article, thanks for sharing. I’ve used a similar script to write my first extension with Dreamweaver – but PHPStorm looks like a great solution for folder mapping. I’ll check it out.

      I’ve also described how to create an extension, including a quick example of a global CSS tweak – perhaps it’s helpful:

    Leave a Comment

    Start typing and press Enter to search