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.

bash
composer require evervault/evervault-php

To use the bindings, use Composer's autoload:

php
require_once('vendor/autoload.php');

Initialization

php
use \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)
ParameterTypeDescription
$dataarray or stringData 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])
ParameterTypeDescription
$cageNamestringName of the Cage to be run.
$dataarrayPayload for the Cage.
$optionsarrayOptions for the cage run.
OptionTypeDefaultDescription
asyncBooleanFalseRun your Cage in async mode. Async Cage runs will be queued for processing.
versionIntegerNullSpecify the version of your Cage to run. By default, the latest version will be run.