Store Data of the Extension

Quite often an extension needs a storage to keep its data - for example, user settings or secret keys. As a developer, you have a variety of ways to store data, like files or databases. Additionally, Plesk provides the mechanism of Key-Value Storage to simplify storing and accessing data.

Encrypting Data

If you need to store arbitrary data in encrypted form, use the following methods of the pm_Crypt class:

Note: when storing data in Plesk Key-Value Storage, use the special methods pm_Settings::setEncrypted() and pm_Settings::getDecrypted().

The following code encrypts the value from your variable:

$password = "secret password";
$encryptedPassword = pm_Crypt::encrypt($password);
// store $encryptedPassword to your own storage

In this chapter:

The Key-Value Storage