PHPackages                             vanguardbackup/vanguard-php-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. vanguardbackup/vanguard-php-sdk

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

vanguardbackup/vanguard-php-sdk
===============================

The official Vanguard PHP SDK.

0.2.7(1y ago)014MITPHPPHP ^8.1CI passing

Since Aug 10Pushed 1y ago1 watchersCompare

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

READMEChangelog (9)Dependencies (8)Versions (10)Used By (0)

[![Vanguard Logo](https://raw.githubusercontent.com/vanguardbackup/assets/main/icon-200.png)](https://raw.githubusercontent.com/vanguardbackup/assets/main/icon-200.png)

 [ ![License: MIT](https://camo.githubusercontent.com/dc711a533e28706ee2da8a3b0307faaf687b67efd75d88c492fd1c37c434c5c2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f76616e67756172646261636b75702f76616e67756172642d7068702d73646b3f7374796c653d666f722d7468652d6261646765266c6f676f3d6f70656e736f75726365696e6974696174697665266c6f676f436f6c6f723d666666666666) ](https://opensource.org/license/mit) [ ![Tests](https://camo.githubusercontent.com/27c27946721633fc468aedf4d92ca96712bcbeec079a911918ddc1b8a12149ac/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f76616e67756172646261636b75702f76616e67756172642d7068702d73646b2f74657374732e796d6c3f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562616374696f6e73266c6f676f436f6c6f723d666666666666266c6162656c3d5465737473) ](https://github.com/vanguardbackup/vanguard-php-sdk/actions/workflows/tests.yml)[ ![GitHub Release](https://camo.githubusercontent.com/62ba613f752864bcc4b03595ccf3d97b8dc353bdd21c6c437c226c27346ad118/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f76616e67756172646261636b75702f76616e67756172642d7068702d73646b3f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562266c6f676f436f6c6f723d666666666666)](https://github.com/vanguardbackup/vanguard-php-sdk/releases)[![Packagist Downloads](https://camo.githubusercontent.com/3ea3878ac92c0891e56e436bd853951873656949cfb51ea0f5e2e31906070af0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f76616e67756172646261636b75702f76616e67756172642d7068702d73646b3f7374796c653d666f722d7468652d6261646765266c6f676f3d7061636b6167697374266c6f676f436f6c6f723d666666666666266c6f676f53697a653d6175746f266c6162656c3d446f776e6c6f616473)](https://packagist.org/packages/vanguardbackup/vanguard-php-sdk)

Vanguard PHP SDK
================

[](#vanguard-php-sdk)

Overview
--------

[](#overview)

The Vanguard PHP SDK provides a fluent interface for interacting with Vanguard's API, enabling efficient management of your backup operations.

API Documentation
-----------------

[](#api-documentation)

For comprehensive API documentation, including request/response schemas and example payloads, please refer to our official API documentation:

[Vanguard API Documentation](https://docs.vanguardbackup.com/api/introduction)

This resource is invaluable when constructing requests or handling responses, especially for complex operations not fully abstracted by the SDK.

Getting Started
---------------

[](#getting-started)

### Installation

[](#installation)

Add the Vanguard PHP SDK to your project using Composer:

```
composer require vanguardbackup/vanguard-php-sdk
```

### Initializing the SDK

[](#initializing-the-sdk)

Create a new instance of the VanguardBackup client:

```
$vanguard = new VanguardBackup\Vanguard\VanguardClient('YOUR_API_KEY');
```

For custom Vanguard installations, specify the API base URL:

```
$vanguard = new VanguardBackup\Vanguard\VanguardClient('YOUR_API_KEY', 'https://your-vanguard-instance.com');
```

Core Functionalities
--------------------

[](#core-functionalities)

### User Authentication

[](#user-authentication)

Retrieve the authenticated user's information:

```
$user = $vanguard->user();
```

### Backup Task Management

[](#backup-task-management)

Manage your backup tasks:

```
// List all backup tasks
$tasks = $vanguard->backupTasks();

// Get a specific backup task
$task = $vanguard->backupTask($taskId);

// Create a new backup task
$newTask = $vanguard->createBackupTask([
    'label' => 'Daily Database Backup',
    'source_type' => 'database',
    // ... other task parameters
]);

// Update an existing backup task
$updatedTask = $vanguard->updateBackupTask($taskId, [
    'frequency' => 'daily',
    // ... other parameters to update
]);

// Delete a backup task
$vanguard->deleteBackupTask($taskId);

// Get the status of a backup task
$status = $vanguard->getBackupTaskStatus($taskId);

// Retrieve the latest log for a backup task
$log = $vanguard->getLatestBackupTaskLog($taskId);

// Manually trigger a backup task
$vanguard->runBackupTask($taskId);
```

Individual `BackupTask` instances also provide methods for common operations:

```
$task->update(['label' => 'Weekly Full Backup']);
$task->delete();
$task->getStatus();
$task->getLatestLog();
$task->run();
```

### Backup Task Log Management

[](#backup-task-log-management)

Manage logs for your backup tasks:

```
// List all backup task logs
$logs = $vanguard->backupTaskLogs();

// Get a specific backup task log
$log = $vanguard->backupTaskLog($logId);

// Delete a backup task log
$vanguard->deleteBackupTaskLog($logId);
```

Individual `BackupTaskLog` instances also provide methods for common operations:

```
$log->delete();
$log->isSuccessful();
$log->isFailed();
```

### Remote Server Management

[](#remote-server-management)

Manage the servers from which you're backing up data:

```
// List all remote servers
$servers = $vanguard->remoteServers();

// Get a specific remote server
$server = $vanguard->remoteServer($serverId);

// Add a new remote server
$newServer = $vanguard->createRemoteServer([
    'label' => 'Production DB Server',
    'ip_address' => '192.168.1.100',
    // ... other server details
]);

// Update a remote server
$updatedServer = $vanguard->updateRemoteServer($serverId, [
    'label' => 'Updated Production DB Server',
]);

// Remove a remote server
$vanguard->deleteRemoteServer($serverId);
```

### Backup Destination Management

[](#backup-destination-management)

Control where your backups are stored:

```
// List all backup destinations
$destinations = $vanguard->backupDestinations();

// Get a specific backup destination
$destination = $vanguard->backupDestination($destinationId);

// Create a new backup destination
$newDestination = $vanguard->createBackupDestination([
    'type' => 's3',
    'bucket' => 'my-backups',
    // ... other destination details
]);

// Update a backup destination
$updatedDestination = $vanguard->updateBackupDestination($destinationId, [
    'bucket' => 'new-backup-bucket',
]);

// Remove a backup destination
$vanguard->deleteBackupDestination($destinationId);
```

### Tag Management

[](#tag-management)

Organize your backup resources with tags:

```
// List all tags
$tags = $vanguard->tags();

// Get a specific tag
$tag = $vanguard->tag($tagId);

// Create a new tag
$newTag = $vanguard->createTag(['label' => 'Production']);

// Update a tag
$updatedTag = $vanguard->updateTag($tagId, ['label' => 'Staging']);

// Delete a tag
$vanguard->deleteTag($tagId);
```

### Notification Stream Management

[](#notification-stream-management)

Configure how you receive alerts about your backups:

```
// List all notification streams
$streams = $vanguard->notificationStreams();

// Get a specific notification stream
$stream = $vanguard->notificationStream($streamId);

// Create a new notification stream
$newStream = $vanguard->createNotificationStream([
    'type' => 'slack',
    'webhook_url' => 'https://hooks.slack.com/services/...',
]);

// Update a notification stream
$updatedStream = $vanguard->updateNotificationStream($streamId, [
    'events' => ['backup_failed', 'backup_successful'],
]);

// Delete a notification stream
$vanguard->deleteNotificationStream($streamId);
```

### SSH Key Management

[](#ssh-key-management)

Retrieve the Vanguard instance SSH public key:

```
// Get the instance SSH public key
$sshKey = $vanguard->getInstanceSshKey();

// Access the public key as a string
echo $sshKey->publicKey;

// Or cast the object to a string to get the public key
echo (string) $sshKey;
```

Security
--------

[](#security)

For reporting security vulnerabilities, please refer to our [security policy](https://github.com/vanguardbackup/vanguard/security/policy).

License
-------

[](#license)

The Vanguard PHP SDK is open-source software, released under the [MIT licence](LICENSE.md).

Acknowledgments
---------------

[](#acknowledgments)

We'd like to express our gratitude to the Laravel Forge PHP SDK, which served as an inspiration for the structure and design of this SDK.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance44

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 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

Every ~25 days

Recently: every ~47 days

Total

9

Last Release

435d ago

PHP version history (2 changes)0.1.0PHP ^7.2|^8.0|^8.1|^8.2|^8.3|^8.4

0.2.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/fb84f66f85c31eee3b74834093d165b3d353eab700e6ed5ba7a907ebf99110a6?d=identicon)[lewislarsen](/maintainers/lewislarsen)

---

Top Contributors

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

---

Tags

open-sourcephpphp-packagephpsdkbackupvanguard

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/vanguardbackup-vanguard-php-sdk/health.svg)

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

###  Alternatives

[phan/phan

A static analyzer for PHP

5.6k11.2M1.1k](/packages/phan-phan)[shlinkio/shlink

A self-hosted and PHP-based URL shortener application with CLI and REST interfaces

4.8k4.3k](/packages/shlinkio-shlink)[volcengine/volc-sdk-php

Volcengine SDK for PHP

35113.0k4](/packages/volcengine-volc-sdk-php)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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