A full reference of our PHP SDK.
You can use our PHP SDK to:
- Encrypt data at your server
- Run your Cages
You can use our PHP SDK to encrypt data — rather than with Relay — and still send it to a third-party via Relay. Encrypting with our backend SDKs is best for developers who want to avoid the network latency of Relay and/or want to avoid sending plaintext data to Relay to be encrypted.
Encrypting data with our backend SDKs instead of Relay may expose you to greater compliance burden because plaintext data touches your server before it is encrypted. If you want to avoid sending plaintext data to Relay and want to reduce your compliance burden — by never having plaintext data touch your infrastructure — using our frontend SDKs to encrypt in the browser or on the client is best.
You don’t need to change your database configuration. You can store Evervault-encrypted data in your database as you would the plaintext version.
Install the Evervault PHP SDK.
- Install it yourself
Our PHP SDK is distributed via Composer.
bashcomposer require evervault/evervault-php
To use the bindings, use Composer's autoload:
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);
The Evervault PHP SDK exposes two functions:
$evervault->encrypt() encrypts data for use in your Cages. To encrypt data on your server, simply pass an
string into the
$evervault->encrypt() function. Store the encrypted data in your database as normal.
php$evervault->encrypt($data = array | string)
|Data to be encrypted.|
$evervault->run() lets you invoke a Cage with a given payload.
php$evervault->run($cageName = string, $data = array[, $options = $array])
|Name of the Cage to be run.|
|Payload for the Cage.|
|Options for the cage run.|
|Run your Cage in async mode. Async Cage runs will be queued for processing.|
|Specify the version of your Cage to run. By default, the latest version will be run.|