Download the PHP package amitdugar/db-tools without Composer

On this page you can find all versions of the php package amitdugar/db-tools. 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 db-tools

db-tools

MySQL/MariaDB backup, restore, and recovery toolkit.

Installation

Quick Start

Setup

If your project already has a .env file (Laravel, Symfony, etc.)

You're done! db-tools automatically reads DB_* variables from your .env file.

If your .env doesn't have database variables yet, run setup:

This will prompt for credentials and add them to your .env file.


If you're starting fresh

Choose where to save config:


Verify your setup

Commands

Backup & Restore

Backup Management

Database Maintenance

Point-in-Time Recovery

Configuration

Profiles (Multiple Databases)

If you manage multiple databases, use profiles. Each profile is a named database configuration that you can switch between.

When to use profiles

Quick setup with profiles

Using profiles

How profiles are stored

In .env file (default) - profiles use prefixed variable names:

In db-tools.php - profiles are array keys:

Cron Jobs

db-tools is designed for cron. Just cd to your project and run:

No environment setup needed in cron - db-tools reads directly from your project's .env file.

Non-Interactive Setup

For deploy scripts and CI/CD pipelines, use --no-prompt mode:

Option Default Description
--no-prompt Run without prompts (required)
-o, --output env Output format: env, config, or profile
-p, --profile default Profile name for multiple databases
--database Database name (required)
--host localhost Database host
--port 3306 Database port
--user root Database user
--password Database password
--output-dir ./backups Backup directory
--retention 7 Retention count

Config Files

Most projects don't need a config file - db-tools reads your .env automatically. Use config files when you need:

db-tools.php (commit to repo)

db-tools.local.php (gitignore, local overrides)

Configuration Reference

Auto-detected environment variables

db-tools automatically reads these from your .env file:

Config file locations (first found wins)

  1. DBTOOLS_CONFIG env var
  2. db-tools.local.php (project root)
  3. db-tools.php (project root)
  4. ~/.config/db-tools/profiles.php

Profile options

Option Type Description
host string Database host (default: localhost)
port int Database port (default: 3306)
database string Database name
user string Database user
password string Database password
output_dir string Backup directory
retention int Keep last N backups
compression string zstd, pigz, gzip, or zip
encryption_password string Encrypt backups (AES-256)
label string Filename prefix

Command-line overrides

Any option can be overridden via CLI or environment:

Encrypted Backups

All compression backends support encryption using GPG with AES-256. There are two ways to encrypt:

Auto-generated password (recommended)

Use --encrypt to automatically generate a secure password. The password is derived from your database password plus a random string embedded in the filename:

How it works: The encryption password is DB_PASSWORD + randomString. Since the random string is embedded in the filename, restore automatically derives the correct password when you provide your database credentials.

Manual password

Use --encryption-password to specify your own password:

Store the password securely (e.g., in environment variable):

How encryption works

Collation Conversion

The collation command converts database tables and columns to utf8mb4 with automatic MySQL version detection:

The command preserves all column attributes: NULL/NOT NULL, DEFAULT values, AUTO_INCREMENT, COMMENT, etc.

Import Formats

The import command handles various file formats:

Extension Description
.sql Plain SQL file
.sql.gz Gzip compressed
.sql.zst Zstandard compressed
.zip ZIP archive (with optional password)
.sql.gpg GPG encrypted
.sql.zst.gpg Compressed + encrypted

Requirements

License

MIT


All versions of db-tools with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
symfony/console Version ^8.1
symfony/process Version ^8.1
psr/log Version ^3.0
amitdugar/archiveutil Version ^2.0
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 amitdugar/db-tools contains the following files

Loading the files please wait ...