toc
PHP SDK
A full reference of our PHP SDK.
The Evervault PHP SDK is a toolkit for encrypting data as it enters your server.
Installation
Install the Evervault PHP SDK.
- Composer
- Install it yourself
Our PHP SDK is distributed via Composer.
bashcomposer require evervault/evervault-php
To use the bindings, use Composer's autoload:
phprequire_once('vendor/autoload.php');
Initialization
phpuse \Evervault\Evervault;// Insert your API key here$evervault = new Evervault('<YOUR_API_KEY>');// Encrypt your sensitive data$encrypted = $evervault->encrypt(['name' => 'Alice']);// Process the encrypted data in a Cage$result = $evervault->run('hello-cage', $encrypted);
Reference
The Evervault PHP SDK exposes two functions:
$evervault->encrypt()
$evervault->run()
\$evervault->encrypt()
$evervault->encrypt()
encrypts data for use in your Cages. To encrypt data on your server, simply pass an array
or string
into the $evervault->encrypt()
function. Store the encrypted data in your database as normal.
php$evervault->encrypt($data = array | string)
Parameter | Type | Description |
---|---|---|
$data | array or string | Data to be encrypted. |
\$evervault->run()
$evervault->run()
lets you invoke a Cage with a given payload.
php$evervault->run($cageName = string, $data = array[, $options = $array])
Parameter | Type | Description |
---|---|---|
$cageName | string | Name of the Cage to be run. |
$data | array | Payload for the Cage. |
$options | array | Options for the cage run. |
Option | Type | Default | Description |
---|---|---|---|
async | Boolean | False | Run your Cage in async mode. Async Cage runs will be queued for processing. |
version | Integer | Null | Specify the version of your Cage to run. By default, the latest version will be run. |