Download the PHP package tearoom1/kirby-ftp-backup without Composer

On this page you can find all versions of the php package tearoom1/kirby-ftp-backup. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package kirby-ftp-backup

Kirby FTP Backup

A Kirby CMS plugin that creates backups of your site content and uploads them to an FTP server.


Features

Installation

Manual Installation

  1. Download or clone this repository
  2. Place the folder kirby-ftp-backup in your site's /site/plugins directory

Composer Installation

Configuration

All configuration is handled through Kirby's option system. Add the following to your site/config/config.php file:

Configuration Options

Option Type Default Description
enabled boolean true Enable/disable the entire plugin
allowedRoles array [] Additional Kirby roles allowed to use the plugin. Admins always have access (see Access Control)
ftpEnabled boolean true Enable/disable FTP uploads (backups still created locally)
ftpProtocol string 'ftp' FTP protocol: 'ftp', 'ftps' or 'sftp'
ftpHost string '' FTP server hostname
ftpPort integer 21 FTP server port
ftpUsername string '' FTP username
ftpPassword string '' FTP password
ftpDirectory string '/' Remote directory to store backups
ftpPassive boolean true Use passive mode
ftpPrivateKey string '' Path to private key file
ftpPassphrase string '' Passphrase for private key
ftpTimeout integer 30 Socket response timeout in seconds (see Advanced Options)
ftpMaxRetries integer 3 Number of reconnect-and-resume attempts after an FTP/FTPS upload failure
ftpRetryDelay integer 5 Seconds to wait before reconnecting for an FTP/FTPS upload retry
ftpKeepAlive integer 0 SFTP only. SSH keepalive interval in seconds, 0 = disabled (see Advanced Options)
cliOutputOnSuccess boolean false Print successful run.php results. Errors are always written to STDERR
backupDirectory string 'content/.backups' Either absolute or relative (to Kirby base) path for local backups
backupRetention integer 10 Number of backups to keep when using simple retention strategy
deleteFromFtp boolean true Whether to delete old backups from FTP server
filePrefix string 'backup-' Prefix for backup filenames
retentionStrategy string 'simple' Backup retention strategy: 'simple' or 'tiered'
tieredRetention array see below Settings for tiered retention strategy
includePatterns array [] Regex patterns (no delimiters, case-insensitive) - if not empty, only matching files are included
excludePatterns array [] Regex patterns (no delimiters, case-insensitive) - matching files are always excluded
excludePaths array [] Relative paths or fnmatch patterns to exclude before regex filtering
excludeContentWatch boolean false Exclude .content-watch.json files from backups
excludeDrafts boolean false Exclude all Kirby _drafts directories from backups
urlExecutionEnabled boolean false Enable URL-based backup execution
urlExecutionToken string '' Security token required for URL-based backup execution

Plugin Control Options

Disable Entire Plugin

To completely disable the plugin (no backups will be created):

When disabled:

Access Control

By default, only users with the admin role can access the plugin — that includes the panel area, the menu entry, the stats view, listing/creating/cancelling backups, and downloading backup files. Non-admins will not see the menu item at all, and any direct API call returns 403 Forbidden.

If you want to grant access to additional Kirby roles (for example, an editor or a dedicated backup-operator role), list them in allowedRoles:

Notes:

Disable FTP Only

To create backups locally but skip FTP uploads:

When FTP is disabled:

This is useful when:

Retention Strategies

The plugin supports two retention strategies for managing old backups:

Simple Retention

Keeps a fixed number of most recent backups, discarding older ones. This is controlled by the backupRetention option.

Tiered Retention

A more sophisticated approach that keeps backups with decreasing frequency as they age:

This strategy:

  1. Keeps all backups from the last X days
  2. Then keeps one backup per week for Y weeks
  3. Then keeps one backup per month for Z months
  4. Deletes anything older

This provides a good balance between recent recovery points and long-term archiving.

File Filtering

You can control which files are included in backups using regex patterns. This is useful for excluding large media files, temporary files, or other content you don't need to back up.

How it works

  1. Default behavior: All files are included
  2. Include patterns: If specified, only files matching these patterns are included
  3. Dedicated excludes: excludeContentWatch, excludeDrafts and excludePaths are applied before regex patterns
  4. Exclude patterns: Files matching these patterns are always excluded
  5. Case-insensitive: Regex patterns are automatically case-insensitive

Examples

Exclude specific file types:

Exclude Content Watch history and drafts:

Exclude specific relative paths:

Include only specific file types:

Exclude large media files but keep images:

Complex filtering:

Note: Patterns are standard regex patterns without delimiters. The plugin automatically adds # delimiters and makes all patterns case-insensitive.

Panel Interface

The plugin adds a "FTP Backup" area to your Kirby Panel:

Automatic Backups with Cron

To set up automatic backups, add a cron job to your server. The cron job should run the included run.php script:

Optionally the path to the kirby root directory can be passed as the first argument:

The root directory is the one with the kirby folder inside.

Successful runs are silent by default. This can be configured globally:

The cron command can override the configuration for a single invocation:

Errors are always written to STDERR and return a non-zero exit code.

Example Crontab Entry

To run a backup every day at 2 AM:

Replace /path/to/site with the actual path to your Kirby installation.

Using the Run Script

The run.php script handles:

URL-Based Backup Execution

As an alternative to cron jobs, you can trigger backups via HTTP requests. This is useful for:

Configuration

First, enable URL execution and set a secure token in your config.php:

⚠️ Security: the token is the only thing protecting this endpoint. The /ftp-backup/execute URL is publicly reachable whenever urlExecutionEnabled is true — it is not behind the panel login, only behind the token. The plugin does not rate-limit failed attempts, so a weak token can be brute-forced.

You must:

  • Generate a long, high-entropy token (at least 32 random characters), e.g. openssl rand -hex 32 or php -r "echo bin2hex(random_bytes(32));". Never use a guessable string.
  • Treat the token like a password: do not commit it to public repos, do not share it in chats, rotate it if exposed.
  • Prefer HTTPS so the token is not sent in the clear.
  • For defense in depth, add rate limiting / IP allow-listing at the web server level (e.g. fail2ban, nginx limit_req, Cloudflare rules). The plugin itself does not throttle requests.
  • If you don't need URL execution, leave urlExecutionEnabled set to false.

Usage

Once configured, you can trigger a backup by making a GET request to:

Security Features

Not provided by the plugin: rate limiting on the execute endpoint. Token strength and any throttling are entirely your responsibility — see the warning above.

Example Response

On success:

On error:

Advanced Options

ftpTimeout

How long to wait for the server to respond to each individual packet, in seconds. This is not a total transfer timeout — large files will transfer for as long as needed as long as the connection stays active. The default of 30 seconds is appropriate for most servers. Increase it only if uploads fail on very slow or high-latency connections.

ftpKeepAlive (SFTP only)

Sends an SSH keepalive packet every N seconds to prevent firewalls or load balancers from dropping idle connections during large uploads. Disabled by default (0).

Note: Some OpenSSH servers respond to keepalives with a [email protected] global request that phpseclib cannot handle mid-transfer, which can interrupt the upload. Only enable this if you have confirmed that idle-timeout drops are the cause of your upload failures.

Security Considerations

Troubleshooting

If you encounter issues:

  1. Check that your FTP credentials and server settings are correct
  2. Verify that the FTP directory exists and has write permissions
  3. Check your server's PHP error logs for any PHP errors
  4. Make sure the local backup directory is writable by PHP
  5. Check if you have the required PHP extensions (zip, ftp)
  6. If uploads fail on slow or high-latency connections, increase ftpTimeout — see Advanced Options
  7. If you get a 504 Gateway Timeout when creating backups from the Panel, increase your web server's proxy/fastcgi read timeout to match or exceed max_execution_time in your php.ini

Requirements

Tests

The tests can be run with:

Make sure to cleanup the vendor after running tests, to remove dev dependencies.

License

This plugin is licensed under the MIT License

Credits


All versions of kirby-ftp-backup with dependencies

PHP Build Version
Package Version
Requires getkirby/composer-installer Version ^1.2
phpseclib/phpseclib Version ^3.0
ext-zip Version *
ext-ftp Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package tearoom1/kirby-ftp-backup contains the following files

Loading the files please wait ...