{"id":14974724,"url":"https://github.com/paulvl/backup","last_synced_at":"2025-04-07T06:09:34.367Z","repository":{"id":1864161,"uuid":"44919142","full_name":"paulvl/backup","owner":"paulvl","description":"MySQL Database backup package for Laravel","archived":false,"fork":false,"pushed_at":"2022-04-07T08:28:18.000Z","size":45,"stargazers_count":81,"open_issues_count":5,"forks_count":30,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-31T04:08:26.941Z","etag":null,"topics":["backup","backup-files","basededatos","bd","copia-de-seguridad","database","database-backup","database-backups","dump","laravel","laravel-framework","laravel-package","laravel8","mysql","mysql-restore","mysqldump","restoration","restore","restore-database"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paulvl.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-25T16:45:24.000Z","updated_at":"2024-12-12T08:26:00.000Z","dependencies_parsed_at":"2022-08-06T11:15:16.504Z","dependency_job_id":null,"html_url":"https://github.com/paulvl/backup","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulvl%2Fbackup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulvl%2Fbackup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulvl%2Fbackup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulvl%2Fbackup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paulvl","download_url":"https://codeload.github.com/paulvl/backup/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247601448,"owners_count":20964864,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backup","backup-files","basededatos","bd","copia-de-seguridad","database","database-backup","database-backups","dump","laravel","laravel-framework","laravel-package","laravel8","mysql","mysql-restore","mysqldump","restoration","restore","restore-database"],"created_at":"2024-09-24T13:50:59.533Z","updated_at":"2025-04-07T06:09:34.345Z","avatar_url":"https://github.com/paulvl.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Backup\n\nBackup is a Laravel package that allow the creation and restoration of database backups in an easy way.\n\n\u003e New version 4.* works with laravel 8\n\n[![Latest Stable Version](https://poser.pugx.org/paulvl/backup/v/stable)](https://packagist.org/packages/paulvl/backup)  [![Latest Unstable Version](https://poser.pugx.org/paulvl/backup/v/unstable)](https://packagist.org/packages/paulvl/backup)  [![License](https://poser.pugx.org/paulvl/backup/license)](https://packagist.org/packages/paulvl/backup)  [![Total Downloads](https://poser.pugx.org/paulvl/backup/downloads)](https://packagist.org/packages/paulvl/backup)\n\n## **Quick Installation**\n\nBegin by installing this package through Composer.\n\nYou can run:\n\n```\ncomposer require paulvl/backup 4.*\n```\n\nOr edit your project's composer.json file to require paulvl/backup.\n\n```\n    \"require\": {\n        \"paulvl/backup\": \"4.*\"\n    }\n```\n\nNext, update Composer from the Terminal:\n\n```\ncomposer update\n```\n\nOnce the package's installation completes, the final step is to add the service provider. Open  `config/app.php`, and add a new item to the providers array:\n\n```\nBackup\\BackupServiceProvider::class,\n```\n\nFinally publish package's configuration file:\n\n```\nphp artisan vendor:publish --provider=\"Backup\\BackupServiceProvider\" --tag=\"config\"\n```\n\nThen the file  `config/backup.php`  will be created.\n\nThat's it! You're ready to go. Run the artisan command from the Terminal to see the new  `backup`  commands.\n\n```\nphp artisan\n```\n\n## **Mysql commands**\n\n### **mysql-dump**  - Creating a backup\n\nTo make a backup of you current aplication's database you have to run:\n\n```\nphp artisan backup:mysql-dump\n```\n\nThis will create an  `.sql`  file on your configured  `local-storage.path`  like  `/this/is/my/path/dbname_20150101201505.sql`, this file is named using current datetime. If you want a custom name run:\n\n```\nphp artisan backup:mysql-dump custom_name\n```\n\nThis will create an  `.sql`  file on your configured  `local-storage.path`  like  `/this/is/my/path/custom_name.sql`\n\n#### **--connection=mysql**  - Specify database connection name\n\nSpecify the database connection name, it uses the primary connection name by default.\n\n```\nphp artisan backup:mysql-dump --connection=custom-connection\n```\n\n#### **--compress**  - Enable file compression\n\u003e From versión *4.** compress option use *gzenconde*. To have your previous compressed files working with this versión see [fix-file](#fix-file----fix-backup-file-encoding-mode) command\n\nEnable file compression regardless if is disabled in the configuration file. This option will always overwrite  `--no-compress`  option\n\n```\nphp artisan backup:mysql-dump --compress\n```\n\n#### **--no-compress**  - Disable file compression\n\nDisable file compression regardless if is enabled in the configuration file. This option will be always overwrited by  `--compress`  option\n\n```\nphp artisan backup:mysql-dump --no-compress\n```\n\n### **mysql-restore**  - Restoring database from a file\n\u003e From versión *4.** compress option use *gzenconde*. To have your previous compressed files working with this versión see [fix-file](#fix-file----fix-backup-file-encoding-mode) command\n\nTo restore a backup to your current aplication's database you have to run:\n\n```\nphp artisan mysql:restore filename\n```\n\nThis will display a list of your current backup files stored on your configured  `local-storage.disk`.\n\n#### **--filename | -f**  - Especifiy a backup file name\n\nEspecifiy a backup file name\n\n```\nphp artisan backup:mysql-restore --filename=backup_filename\n```\n\n#### **--all-backup-files | -A**  - Display all backup files\n\nDisplay all available backup files on disk. By default displays files for current connection's database.\n\n```\nphp artisan backup:mysql-restore --all-backup-files\n```\n\n#### **--from-cloud | -C**  - Use cloud disk\n\nDisplay a list of backup files from cloud disk.\n\n```\nphp artisan backup:mysql-restore --from-cloud\n```\n\n#### **--restore-latest-backup | -L**  - Restore latest backup file\n\nUse latest backup file to restore database.\n\n```\nphp artisan backup:mysql-restore --restore-latest-backup\n```\n\n#### **--yes | -y**  - Confirms restoration action\n\nConfirms database restoration without asking.\n\n```\nphp artisan backup:mysql-restore --yes\n```\n\n### **fix-file**  - Fix backup file encoding mode\n\n\u003e Prior to version *4.** all backup files generated with compression option where compressed using *gzenconde*, by this the generated file was unable to use with any other uncompression software. Thats why we now use *gzencode* instead which is friendly to external software.\n\nTo fix the encoding mode of a compressed backup file you have to run:\n\n```\nphp artisan mysql:fix-file\n```\n\nThis will display a list of your current compressed backup files stored on your configured  `local-storage.disk`.\n\n#### **--filename | -f**  - Especifiy a backup file name\n\nEspecifiy a backup file name\n\n```\nphp artisan backup:fix-file --filename=backup_filename\n```\n\n#### **--from-cloud | -C**  - Use cloud disk\n\nDisplay a list of backup files from cloud disk.\n\n```\nphp artisan backup:fix-file --from-cloud\n```\n\n#### **--yes | -y**  - Confirms fixing action\n\nConfirms file fixing without asking.\n\n```\nphp artisan backup:fix-file --yes\n```\n\n### **Programing backups**\n\nIf you need to perform a backup for example, every day at midnight, at this like to yor schedule function on  `app/Console/Commands/Kernel.php`:\n\n```\nprotected function schedule(Schedule $schedule)\n{\n...\n    $schedule-\u003ecommand('backup:mysql-dump')-\u003edailyAt('00:00');\n...\n}\n```\n\n## **Contribute and share ;-)**\n\nIf you like this little piece of code share it with you friends and feel free to contribute with any improvements.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaulvl%2Fbackup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaulvl%2Fbackup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaulvl%2Fbackup/lists"}