1. Go to this page and download the library: Download fluxsave/sdk library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
fluxsave / sdk example snippets
use VaultSens\VaultSensClient;
$client = new VaultSensClient(
'https://api.vaultsens.com',
'your-api-key',
'your-api-secret'
);
$result = $client->uploadFile('./photo.png', 'hero', 'low', null, 'photo.png', 'image/png');
echo $result['data']['_id']; // file ID
echo $result['data']['url']; // public URL
$result = $client->uploadFile(
'./photo.png',
'my-image', // optional display name stored with the file
'medium', // optional compression level applied server-side
'folder-id', // optional folder to place the file in
'photo.png', // optional multipart filename sent to VaultSens
'image/png' // optional explicit MIME type
);
use VaultSens\VaultSensError;
try {
$client->uploadFile('./photo.png');
} catch (VaultSensError $e) {
echo $e->getMessage(); // human-readable message
echo $e->getCode(); // HTTP status code
echo $e->errorCode; // machine-readable error code
switch ($e->errorCode) {
case VaultSensError::FILE_TOO_LARGE:
echo 'File exceeds your plan limit';
break;
case VaultSensError::STORAGE_LIMIT:
echo 'Storage quota exceeded';
break;
case VaultSensError::MIME_TYPE_NOT_ALLOWED:
echo 'File type not allowed on your plan';
break;
case VaultSensError::COMPRESSION_NOT_ALLOWED:
echo 'Compression level not permitted on your plan';
break;
case VaultSensError::FILE_COUNT_LIMIT:
echo 'File count limit reached';
break;
case VaultSensError::FOLDER_COUNT_LIMIT:
echo 'Folder count limit reached';
break;
case VaultSensError::SUBSCRIPTION_INACTIVE:
echo 'Subscription is not active';
break;
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.