This tutorial on writing extensions gives you a hands-on introduction to the Plesk extensions SDK. Starting from specially-prepared code, it guides you through the process of developing a typical extension with the GUI, a simple news feed reader, and, finally, the extension which displays usage statistics.
Each exercise consists of several steps. You should follow the steps to gradually create and refine your extension. The exercises explain each step in detail and provide all the sample code you need to complete the extension.
After you complete the tutorial, you will learn many of the most important concepts in extensions development. If you want to add more complex features to your extensions, examine the extensions SDK reference.
Preparing for the Exercises
To prepare for the exercises, browse our GitHub page. You should see six subdirectories: ex1, ex2, ex3, ex1complete, ex2complete, and ex3complete. The ex# directories are the starting points for each of the exercises, while the ex#complete directories are completed exercises. If you are having trouble with a particular exercise, you can compare your current work against the completed variant.
Unless otherwise stated, directory paths in the following exercises are given relatively to the root directory of an extension (which is the contents of ex# or ex#complete).
The table below lists the tutorial exercises and describes the development areas that each covers. Exercises do not depend on each other; you can complete them in an arbitrary order.
Exercise 1. Tabs, Forms, Lists, Tools
Construct tabs, add a form, add an items list, and add a few buttons to the toolbar. Demonstrates the basics of creating the most popular GUI elements.
Exercise 2. Task Scheduling and Dashboard Integration
Add a scheduled task and a dashboard widget. Demonstrates integration with the Plesk scheduling interface and Dashboard (the Home page).
Exercise 3. Working with Plesk Objects
Get usage statistics using the XML API interface. Demonstrates how to work with XML API and pass control directly to PHP scripts.