PHPackages                             vaultsens/sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. vaultsens/sdk

ActiveLibrary[API Development](/categories/api)

vaultsens/sdk
=============

VaultSens SDK for API key uploads and file management

v0.1.8(2mo ago)01↓66.7%MITPHPPHP &gt;=8.1

Since Feb 21Pushed 2mo agoCompare

[ Source](https://github.com/lutheralien/vaultsens-sdk-php)[ Packagist](https://packagist.org/packages/vaultsens/sdk)[ RSS](/packages/vaultsens-sdk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

vaultsens/sdk
=============

[](#vaultsenssdk)

PHP SDK for VaultSens. API key + secret authentication with file upload, folder management, and image transform helpers.

Install
-------

[](#install)

```
composer require vaultsens/sdk
```

Quick start
-----------

[](#quick-start)

```
use VaultSens\VaultSensClient;

$client = new VaultSensClient(
    'https://api.vaultsens.com',
    'your-api-key',
    'your-api-secret'
);

$result = $client->uploadFile('./photo.png', 'hero', 'low');
echo $result['data']['_id'];  // file ID
echo $result['data']['url'];  // public URL
```

---

API reference
-------------

[](#api-reference)

### `new VaultSensClient(baseUrl, apiKey, apiSecret)`

[](#new-vaultsensclientbaseurl-apikey-apisecret)

ParameterTypeDescription`$baseUrl``string`Your VaultSens API base URL`$apiKey``string|null`API key`$apiSecret``string|null`API secretUse `setAuth($apiKey, $apiSecret)` to set credentials after construction.

---

### Files

[](#files)

#### `uploadFile($filePath, $name = null, $compression = null, $folderId = null)`

[](#uploadfilefilepath-name--null-compression--null-folderid--null)

Upload a single file.

```
$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
);
```

**Parameters**

ParameterTypeDescription`$filePath``string`Path to the file on disk`$name``string|null`Display name stored with the file`$compression``string|null`Server-side compression: `'none'` | `'low'` | `'medium'` | `'high'`. Must be allowed by your plan`$folderId``string|null`ID of the folder to place the file in. Omit for root#### `uploadFiles(array $filePaths, $name = null, $compression = null, $folderId = null)`

[](#uploadfilesarray-filepaths-name--null-compression--null-folderid--null)

Upload multiple files in one request. Accepts the same parameters as `uploadFile`.

```
$result = $client->uploadFiles(
    ['./a.png', './b.jpg'],
    null,
    'low',
    'folder-id'
);
```

#### `listFiles($folderId = null)`

[](#listfilesfolderid--null)

List all files. Pass `$folderId` to filter by folder, or `"root"` for files not in any folder.

```
$all     = $client->listFiles();
$inDir   = $client->listFiles('folder-id');
$atRoot  = $client->listFiles('root');
```

#### `getFileMetadata($fileId)`

[](#getfilemetadatafileid)

```
$meta = $client->getFileMetadata('file-id');
```

#### `updateFile($fileId, $filePath, $name = null, $compression = null)`

[](#updatefilefileid-filepath-name--null-compression--null)

Replace a file's content. Accepts `$name` and `$compression` — `$folderId` is not supported (file stays in its current folder).

```
$client->updateFile('file-id', './new-photo.png', null, 'high');
```

#### `deleteFile($fileId)`

[](#deletefilefileid)

```
$client->deleteFile('file-id');
```

#### `buildFileUrl($fileId, array $options = [])`

[](#buildfileurlfileid-array-options--)

Build a URL for dynamic image transforms. No network request is made.

```
$url = $client->buildFileUrl('file-id', [
    'width'   => 800,
    'height'  => 600,
    'format'  => 'webp',
    'quality' => 80,
]);
```

**Transform options**

KeyTypeDescription`width``int?`Output width in pixels`height``int?`Output height in pixels (fit: inside, aspect ratio preserved)`format``string?`Output format e.g. `'webp'`, `'jpeg'`, `'png'``quality``int?`Compression quality `1–100`---

### Folders

[](#folders)

#### `listFolders()`

[](#listfolders)

```
$result  = $client->listFolders();
$folders = $result['data'];
```

#### `createFolder($name, $parentId = null)`

[](#createfoldername-parentid--null)

```
$result   = $client->createFolder('Marketing');
$folderId = $result['data']['_id'];

// nested folder
$client->createFolder('2024', $folderId);
```

#### `renameFolder($folderId, $name)`

[](#renamefolderfolderid-name)

```
$client->renameFolder('folder-id', 'New Name');
```

#### `deleteFolder($folderId)`

[](#deletefolderfolderid)

Deletes the folder and moves all its files back to root.

```
$client->deleteFolder('folder-id');
```

---

### Metrics

[](#metrics)

```
$result = $client->getMetrics();
$data   = $result['data'];
// $data['totalFiles'], $data['totalStorageBytes'], $data['storageUsedPercent'], ...
```

---

Error handling
--------------

[](#error-handling)

All API errors throw a `VaultSensError` with an `$errorCode`, HTTP status code, and message.

```
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;
    }
}
```

### Error codes

[](#error-codes)

ConstantStatusDescription`FILE_TOO_LARGE`413File exceeds plan's `maxFileSizeBytes``STORAGE_LIMIT`413Total storage quota exceeded`FILE_COUNT_LIMIT`403Plan's `maxFilesCount` reached`MIME_TYPE_NOT_ALLOWED`415File type blocked by plan`COMPRESSION_NOT_ALLOWED`403Compression level not permitted by plan`SUBSCRIPTION_INACTIVE`402User subscription is not active`FOLDER_COUNT_LIMIT`403Plan's `maxFoldersCount` reached`EMAIL_ALREADY_REGISTERED`400Duplicate email on register`EMAIL_NOT_VERIFIED`403Login attempted before verifying email`INVALID_CREDENTIALS`400Wrong email or password`INVALID_OTP`400Bad or expired verification code`UNAUTHORIZED`401Missing or invalid credentials`NOT_FOUND`404Resource not found`UNKNOWN`—Any other error---

License
-------

[](#license)

MIT

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance83

Actively maintained with recent releases

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

87d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/846ed07f3eb342255c6e85494b0760fce4b8a3653a4c4a13e911def24581318a?d=identicon)[lutheralien](/maintainers/lutheralien)

---

Top Contributors

[![lutheralien](https://avatars.githubusercontent.com/u/102399984?v=4)](https://github.com/lutheralien "lutheralien (4 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/vaultsens-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/vaultsens-sdk/health.svg)](https://phpackages.com/packages/vaultsens-sdk)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
