WatheqAlshowaiter/backup-tables
WatheqAlshowaiter/backup-tables has 38 GitHub stars and 3 forks. GitHot measured -1 stars in 24 hours, -1 in 7 days, and 0 in 15 days. Last checked 2026-11-11 13:48 UTC. Last push 2026-11-02.
So werden diese Zahlen gemessen
Backup single or multiple database tables with ease.
Gemessener Sternzuwachs
- in 24h
- -1
- in 7 days
- -1
- in 15 days
- 0
- in 1 month
- Aktualisierung verzögert
Nettoänderungen in überlappenden Zeiträumen, keine Tagessummen. Fehlende Messwerte bleiben leer. Sterne zeigen Interesse, nicht Qualität.
README.md
Original
Backup Tables
Backup single or multiple database tables with ease.
[!NOTE] If you want a full database backup with many features, go for Spatie Laravel Backup.
Installation
You can install the package via Composer:
composer require watheqalshowaiter/backup-tables
Usage
Use the BackupTables::generateBackup($tableToBackup) Facade anywhere in your application and it will
generate $tableToBackup_backup_2024_08_22_17_40_01 table in the database with all the data and structure. Note that
the datetime 2024_08_22_17_40_01 will be varied based on your datetime.
You can also use the php artisan backup:tables <targets> command to back up tables,
where <targets> is a space-separated list of table names or models.
use WatheqAlshowaiter\BackupTables\BackupTables; // import the facade
class ChangeSomeData
{
public function handle()
{
BackupTables::generateBackup('users');
// result: users_backup_2024_08_22_17_40_01
// change some data..
}
}
And More Customizations
- You can use an array to back up more than one table
BackupTables::generateBackup(['users', 'posts']);
// users_backup_2024_08_22_17_40_01
// posts_backup_2024_08_22_17_40_01
- Or add Classes as parameters, It will backup their tables
BackupTables::generateBackup(User::class);
// users_backup_2024_08_22_17_40_01
// or
BackupTables::generateBackup([User::class, Post::class]);
// users_backup_2024_08_22_17_40_01, posts_backup_2024_08_22_17_40_01
- You can customize the $dataTime format to whatever you want
BackupTables::generateBackup('users', 'Y_d_m_H_i');
// users_backup_2024_22_08_17_40
[!WARNING] When customizing the datetime format, be aware that backups with identical datetime values will be skipped. For example, if you use this
Y_d_m_Hyou cannot generate the same backup in the same hour. The default format (Y_m_d_H_i_s) is recommended for most cases.
BackupTables::generateBackup('users', 'Y_d_m_H');
// can not generate the same backup in the same hour
BackupTables::generateBackup('users', 'Y_d_m');
// can not generate the same backup in the same day
- Using the artisan command for one or more tables/models
php artisan backup:tables users posts
# users_backup_2024_08_22_17_40_01, posts_backup_2024_08_22_17_40_01
php artisan backup:tables \\App\\Models\\User \\App\\Models\\Post
# users_backup_2024_08_22_17_40_01, posts_backup_2024_08_22_17_40_01
Why?
Sometimes you want to back up some database tables before changing data for whatever reason, this package serves this need.
I used it personally before adding foreign keys to tables that required removing unlinked fields from parent tables.
You may find some situation where you play with table data, or you're afraid of missing data, so you back up these tables beforehand.
Features
✅ Backup tables from the code using (Facade) or from the console command.
✅ Supports Laravel versions: 13, 12, 11, 10, 9, 8, 7, and 6.
✅ Supports PHP versions: 8.4, 8.3, 8.2, 8.1, 8.0, and 7.4.
✅ Supports SQL databases: SQLite, MySQL/MariaDB, PostgreSQL, and SQL Server.
✅ Fully automated tested with PHPUnit.
✅ Full GitHub Action CI pipeline to format code and test against all Laravel and PHP versions.
Testing
composer test
Changelog
Please see CHANGELOG for more information on recent changes.
Contributing
If you have any ideas or suggestions to improve it or fix bugs, your contribution is welcome.
I encourage you to look at issues which are the most important features that need to be added.
If you have something different, submit an issue first to discuss or report a bug, then do a pull request.
Security Vulnerabilities
If you find any security vulnerabilities don't hesitate to contact me at watheqalshowaiter[at]gmail[dot]com to fix
them.
Related Packages
- Model Fields - Quickly retrieve required, nullable, and default fields for any Laravel model.
- Filament Sticky Table Header - Make Filament table headers stick when scrolling for better UX.
- Quran Validator for PHP - Validate and verify Quranic verses in LLM-generated text with high accuracy.
Support this project
If this project helps you, consider supporting it on Ko-fi ☕.
Credits
Omar Alalwi - This package is based on his initial code.
And a special thanks to The King Creative for the logo ✨
License
The MIT License (MIT). Please see License File for more information.
Ähnliche Projekte entdecken
Asabeneh/30-Days-Of-Python
Die Programmier-Challenge 30 Days of Python ist eine Schritt-für-Schritt-Anleitung, um die Programmiersprache Python in 30 Tagen zu lernen. Diese Challenge kann mehr als 100 Tage dauern. Gehe in deinem eigenen Tempo vor. Diese Videos können ebenfalls helfen: https://www.youtube.com/channel/UC7PNRuno1rzYPb1xLa4yktw
78,618 Sternegrafana/grafana
Offene und kombinierbare Plattform für Observability und Datenvisualisierung. Visualisiert Metriken, Logs und Traces aus mehreren Quellen wie Prometheus, Loki, Elasticsearch, InfluxDB, Postgres und vielen weiteren.
77,859 Sterneredis/redis
Für Entwickler, die echtzeitfähige, datengesteuerte Anwendungen erstellen, ist Redis der bevorzugte, schnellste und funktionsreichste Cache, Datenstrukturserver und die entsprechende Abfrageengine für Dokumente und Vektoren.
77,472 Sterneapache/superset
Apache Superset ist eine Plattform für Datenvisualisierung und Datenexploration.
75,495 Sterne