PHPackages                             silverstripe/sspak - 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. [CLI &amp; Console](/categories/cli)
4. /
5. silverstripe/sspak

ActiveLibrary[CLI &amp; Console](/categories/cli)

silverstripe/sspak
==================

CLI tool for saving &amp; loading data in SilverStripe installations

4616.9k↓50%36[25 issues](https://github.com/silverstripe/sspak/issues)[1 PRs](https://github.com/silverstripe/sspak/pulls)1PHPCI failing

Since Jun 13Pushed 1y ago14 watchersCompare

[ Source](https://github.com/silverstripe/sspak)[ Packagist](https://packagist.org/packages/silverstripe/sspak)[ RSS](/packages/silverstripe-sspak/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (1)

SSPak
=====

[](#sspak)

[![Build Status](https://camo.githubusercontent.com/3272beb93ed0faf5f6bd7f840e91bd12ccfd1741663bec53c379be9b84eb9082/68747470733a2f2f6170692e7472617669732d63692e636f6d2f73696c7665727374726970652f737370616b2e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/silverstripe/sspak)[![Code Quality](https://camo.githubusercontent.com/f0f52d84325c4e8bf03e7f9fa36db984616a1b7712b7fda4bdc217d5a9c21e45/687474703a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f73696c7665727374726970652f737370616b2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/silverstripe/sspak)

SSPak is a SilverStripe tool for managing database and assets content, for back-up, restoration, or transfer between environments.

The file format
---------------

[](#the-file-format)

An sspak file is either a Phar (executable) file or a Tar (non-executable) file, containing the following files at the top level:

- **database.sql.gz:** A gzipped SQL file that will re-create the entire database, including all content. It will contain the 'drop' statements necessary to replace any existing content as needed.
- **assets.tar.gz:** A gzipped tar file containing all assets. The root directory within the tar file must be called "assets".
- **git-remote:** A text file of the following form:

    remote = (url) branch = (name) sha = (sha-hash)

By convention, the file should have the extension `.sspak` for non-executable versions, and `.sspak.phar` for executable versions.

Installation
------------

[](#installation)

You can run the installation script one of three ways.

### Composer (recommended)

[](#composer-recommended)

You can install this package globally with Composer (ensure your composer bin is in your system path):

```
$> composer global require silverstripe/sspak:dev-master

```

You can also require it directly in your project

```
$> composer require --dev silverstripe/sspak
$> vendor/bin/sspak

```

### cURL

[](#curl)

**Note: the downloaded sspak.phar may be out of date**

If you have cURL, run this command (everything except for the `$>` part):

```
$> curl -sS https://silverstripe.github.io/sspak/install | php -- /usr/local/bin

```

The final argument is the directory that the script will be loaded into. If omitted, the script will be installed into the current directory. If you don't have permission to write to the directory, "sudo" will be used to escalate permissions.

For example, this would also work:

```
$> cd /usr/local/bin
$> curl -sS https://silverstripe.github.io/sspak/install | sudo php

```

### Manually

[](#manually)

**Note: the downloaded sspak.phar may be out of date**

If you prefer not to use the installer, you can download the script and copy it to your executable path as follows:

```
$> wget https://silverstripe.github.io/sspak/sspak.phar
$> chmod +x sspak.phar
$> sudo mv sspak.phar /usr/local/bin/sspak

```

Common Issues
-------------

[](#common-issues)

```
Creating archive disabled by the php.ini setting phar.readonly

```

Set your phar.readonly setting to false in your php.ini (and php-cli.ini) files.

Use
---

[](#use)

All sspak commands take the following general form.

```
$> sspak (command) (from) (to)

```

Create an sspak file and save to /tmp:

```
$> sspak save /var/www /tmp/site.sspak

```

Create an sspak file based on a remote site:

```
$> sspak save me@prodserver:/var/www prod-site.sspak

```

Create an sspak file based on a remote site using a specific private key to connect:

```
$> sspak save --identity=prodserver.key me@prodserver:/var/www prod-site.sspak

```

Create an executable sspak file by adding a phar extension:

```
$> sspak save me@prodserver:/var/www prod-site.sspak.phar

```

Create an sspak from existing files:

```
$> sspak saveexisting --db=/path/to/database.sql --assets=/path/to/assets /tmp/site.sspak

```

Extract files from an existing sspak into the specified directory:

```
$> sspak extract /tmp/site.sspak /destination/path

```

Load an sspak file into a local instance:

```
$> sspak load prod-site.sspak ~/Sites/devsite

```

Load an sspak file into a local instance, dropping the existing DB first (mysql only):

```
$> sspak load prod-site.sspak ~/Sites/devsite --drop-db

```

Load an sspak file into a remote instance using a specific private key to connect:

```
$> sspak save --identity=backupserver.key prod-site.sspak me@backupserver:/var/www

```

Transfer in one step: *(not implemented yet)*

```
$> sspak transfer me@prodserver:/var/www ~/Sites/devsite

```

Sudo as www-data to perform the actions

```
$> sspak save --sudo=www-data me@prodserver:/var/www prod-site.sspak
$> sspak load --sudo=www1 prod-site.sspak ~/Sites/devsite
$> sspak transfer --from-sudo=www-data --to-sudo=www1 me@prodserver:/var/www ~/Sites/devsite

```

Save only the database:

```
$> sspak save --db me@prodserver:/var/www dev.sspak

```

Load only the assets:

```
$> sspak load --assets dev.sspak ~/Sites/devsite

```

Install a new site from an sspak (needs to contain a git-remote):

```
$> sspak install newsite.sspak ~/Sites/newsite

```

Save all while using a custom TMP folder (make sure the folder exists and is writable):

```
$> TMPDIR="/tmp/my_custom_tmp" sspak save /var/www /tmp/site.sspak

```

Caveats
-------

[](#caveats)

If you don't have PKI passwordless log-in into remote servers, you will be asked for your log-in a few times.

Notes
-----

[](#notes)

When using sspak with some versions of mysql you may see the output `mysqldump: unknown variable 'column-statistics=0'`. It is safe to just ignore this.

How it works
------------

[](#how-it-works)

sspak relies on the SilverStripe executable code to determine database credentials. It does this by using a small script, sspak-sniffer.php, which it uploads to the /tmp folder of any remote servers.

This script returns database credentials and the location of the assets path. Once it has that, it will remotely execute mysql, mysqldump and tar commands to archive or restore the content.

It expects the following commands to be available on any remote servers:

- php
- mysql
- mysqldump
- tar
- gzip
- sudo

It will also use the /tmp folder on the machine that you are running from, and it will need to have enough free space on there to create temporary copies of the individual files within the .sspak file, if you are using the non-executable version. .sspak.phar files can be populated without needing a tmp file in between.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity40

Moderate usage in the ecosystem

Community32

Small or concentrated contributor base

Maturity18

Early-stage or recently created project

 Bus Factor3

3 contributors hold 50%+ of commits

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.

### Community

Maintainers

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

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

![](https://www.gravatar.com/avatar/afbb3dcc9ef29c1a6eedd6addcae5fce9ab1271915a85a4c349301b71237368d?d=identicon)[silverstripe-machine01](/maintainers/silverstripe-machine01)

![](https://avatars.githubusercontent.com/u/1168676?v=4)[Maxime Rainville](/maintainers/maxime-rainville)[@maxime-rainville](https://github.com/maxime-rainville)

---

Top Contributors

[![dhensby](https://avatars.githubusercontent.com/u/563596?v=4)](https://github.com/dhensby "dhensby (19 commits)")[![mateusz](https://avatars.githubusercontent.com/u/118653?v=4)](https://github.com/mateusz "mateusz (8 commits)")[![robbieaverill](https://avatars.githubusercontent.com/u/5170590?v=4)](https://github.com/robbieaverill "robbieaverill (6 commits)")[![emteknetnz](https://avatars.githubusercontent.com/u/4809037?v=4)](https://github.com/emteknetnz "emteknetnz (4 commits)")[![michalkleiner](https://avatars.githubusercontent.com/u/233342?v=4)](https://github.com/michalkleiner "michalkleiner (3 commits)")[![GuySartorelli](https://avatars.githubusercontent.com/u/36352093?v=4)](https://github.com/GuySartorelli "GuySartorelli (2 commits)")[![n8-dev](https://avatars.githubusercontent.com/u/11827838?v=4)](https://github.com/n8-dev "n8-dev (2 commits)")[![NZI](https://avatars.githubusercontent.com/u/4575864?v=4)](https://github.com/NZI "NZI (1 commits)")[![sabina-talipova](https://avatars.githubusercontent.com/u/87288324?v=4)](https://github.com/sabina-talipova "sabina-talipova (1 commits)")[![sunnysideup](https://avatars.githubusercontent.com/u/167154?v=4)](https://github.com/sunnysideup "sunnysideup (1 commits)")[![adrexia](https://avatars.githubusercontent.com/u/984753?v=4)](https://github.com/adrexia "adrexia (1 commits)")[![wilr](https://avatars.githubusercontent.com/u/101629?v=4)](https://github.com/wilr "wilr (1 commits)")[![andrewandante](https://avatars.githubusercontent.com/u/9702648?v=4)](https://github.com/andrewandante "andrewandante (1 commits)")[![anselmdk](https://avatars.githubusercontent.com/u/1316533?v=4)](https://github.com/anselmdk "anselmdk (1 commits)")[![Cheddam](https://avatars.githubusercontent.com/u/242621?v=4)](https://github.com/Cheddam "Cheddam (1 commits)")[![jeremyolliver](https://avatars.githubusercontent.com/u/14826?v=4)](https://github.com/jeremyolliver "jeremyolliver (1 commits)")[![McJoppy](https://avatars.githubusercontent.com/u/3344098?v=4)](https://github.com/McJoppy "McJoppy (1 commits)")[![mikenz](https://avatars.githubusercontent.com/u/6816?v=4)](https://github.com/mikenz "mikenz (1 commits)")

### Embed Badge

![Health badge](/badges/silverstripe-sspak/health.svg)

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

###  Alternatives

[wp-cli/wp-cli

WP-CLI framework

5.1k17.2M320](/packages/wp-cli-wp-cli)[consolidation/annotated-command

Initialize Symfony Console commands from annotated command class methods.

22569.8M19](/packages/consolidation-annotated-command)[seld/cli-prompt

Allows you to prompt for user input on the command line, and optionally hide the characters they type

24725.8M17](/packages/seld-cli-prompt)[illuminate/console

The Illuminate Console package.

12944.1M5.1k](/packages/illuminate-console)[php-tui/php-tui

Comprehensive TUI library heavily influenced by Ratatui

589747.0k6](/packages/php-tui-php-tui)[codedungeon/php-cli-colors

Liven up you PHP Console Apps with standard colors

10210.1M26](/packages/codedungeon-php-cli-colors)

PHPackages © 2026

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