cyberwizard / dbsafeguard
A Laravel package for safeguarding your database with easy-to-use backup commands.
This package is not auto-updated.
Last update: 2024-09-25 17:02:26 UTC
README
DBSafeguard Database Backup is a simple Laravel package that provides a convenient command-line interface to backup your database.
Installation
- Install the package via Composer:
composer require cyberwizard/dbsafeguard:dev-main
- Usage:
To manually backup your database, run the following command:
php artisan backup:db
The backup file will be stored in the storage/app/backups
directory with a timestamped filename.
- Schedule Backups:
You can schedule automatic backups by adding the following entry to your Laravel task scheduler (usually defined in the App\Console\Kernel
class):
$schedule->command('backup:db')->daily();
This will run the database backup command daily. Adjust the schedule as needed. Here are some examples:
$schedule->command('backup:db')->daily();
- Run daily at midnight.$schedule->command('backup:db')->dailyAt('3:00');
- Run daily at 3:00 AM.$schedule->command('backup:db')->twiceDaily(1, 13);
- Run twice a day at 1:00 AM and 1:00 PM.
Configuration
The package uses environment variables (DB_DATABASE
, DB_USERNAME
, DB_PASSWORD
) to connect to the database. Ensure these variables are correctly set in your .env
file.
Author
Cyberwizard
Contact: eminibest@gmail.com
License
This package is open-sourced software licensed under the MIT license.
Extra
Installation
You can install this package directly from the GitHub repository. Follow the steps below:
-
Open your project's
composer.json
file. -
Add the GitHub repository to the
repositories
key:"repositories": [ { "type": "vcs", "url": "https://github.com/cyberwizard-dev/DBSafeGuard/" } ],
-
In the
require
section, specify the package name and version:"require": { "cyberwizard/DBSafeGuard/": "dev-main" },
-
Run the following command to install the package:
composer install
This will fetch the package directly from the GitHub repository and install it in your project.