phpbu
Backup PHP projects' databases and files
TLDR
Run backups using the default phpbu.xml configuration file
Run backups using a specific configuration file
Only run the specified backups
Simulate the actions that would have been performed
SYNOPSIS
phpbu [options] [arguments]
phpbu [--configuration=file] [--bootstrap=file] [--target=target_name] [options]
PARAMETERS
--configuration / -c
Specifies the path to the configuration file (XML, YAML, or JSON).
--bootstrap
Specifies a PHP file to be loaded before execution.
--target
Executes only a specific target defined in the configuration.
--simulate / -s
Performs a dry run, showing what would happen without actual execution.
--force / -f
Forces the backup process, e.g., overwriting existing backups.
--debug
Enables debug output for detailed information.
--verbose / -v / -vv / -vvv
Increases the verbosity of messages.
--version / -V
Displays the phpbu version information.
--help / -h
Displays a help message with command options.
--ansi
Forces ANSI output, useful for colored terminal output.
--no-ansi
Disables ANSI output.
--no-interaction
Do not ask any interactive questions.
--generate-schema
Generates an XSD schema for XML configuration validation.
--log-path
Specifies a path for log files.
--skip-config-validation
Skips the validation of the XML configuration file.
DESCRIPTION
phpbu is a powerful and flexible command-line tool written in PHP, designed to automate the process of creating and managing backups for web applications and databases. It abstracts away the complexity of handling various backup scenarios by providing a unified, configuration-driven approach.
The tool supports a wide array of database systems, including MySQL, PostgreSQL, MongoDB, and Redis, allowing users to export data reliably. For file backups, it integrates with common archiving tools like tar and zip, and can also utilize rsync for efficient synchronization.
Key features of phpbu include support for multiple storage providers (such as local file systems, Amazon S3, Dropbox, SFTP, and WebDAV), data compression and encryption, automated cleanup of old backups, and various notification mechanisms (email, Slack, custom webhooks) to alert administrators about backup status.
Configured primarily via XML, YAML, or JSON files, phpbu promotes maintainability and scalability, making it an ideal choice for PHP developers and system administrators looking for a reliable, extensible, and automated backup solution for their PHP-based projects.
CAVEATS
phpbu relies heavily on external system utilities (e.g., mysqldump, pg_dump, tar, gzip, rsync) being installed and accessible in the system's PATH. Ensure these dependencies are met for all desired backup types.
Proper PHP CLI environment setup, including necessary extensions (e.g., zip, phar), is crucial for its operation.
While powerful, the configuration file can become complex for highly customized or large-scale backup strategies, requiring careful planning and testing.
CONFIGURATION FILES
phpbu primarily uses configuration files to define backup strategies. It supports XML, YAML, and JSON formats, offering flexibility for different preferences and project setups. These files define sources (databases, directories), destinations (storages), and post-backup actions (cleanup, notifications, synchronization).
EXTENSIBILITY
The tool is designed with extensibility in mind, allowing users to create custom adapters for new storage providers, synchronizers, or notification services. This plugin-based architecture ensures phpbu can adapt to a wide range of unique backup requirements.
SCHEDULING
While phpbu itself is a command-line tool, it is typically scheduled to run automatically using system schedulers like cron on Linux/Unix systems or Task Scheduler on Windows, ensuring regular and timely backups without manual intervention.
HISTORY
phpbu originated as a solution to automate common backup tasks for PHP applications. Over time, it evolved from a simple script into a robust, extensible framework, driven by a need for a reliable, open-source, and configuration-driven backup tool within the PHP ecosystem. Its development has focused on modularity, allowing for easy integration with various storage, synchronization, and notification services, making it a staple for developers managing their own server environments.