Download the PHP package blalmal10a/db-archive without Composer
On this page you can find all versions of the php package blalmal10a/db-archive. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download blalmal10a/db-archive
More information about blalmal10a/db-archive
Files in blalmal10a/db-archive
Package db-archive
Short Description Easily backup and restore laravel database tables by saving them into zip files.
License MIT
Homepage https://github.com/blalmal10a/db-archive
Informations about the package db-archive
Easily backup and restore Laravel database tables by saving them into zip files.
db-archive exports database tables into chunked CSV files (400 rows per chunk), packages them into a zip with schema JSON, and can restore tables from those zip files — all through a web UI or API.
Installation
The package works immediately after installation — no migrations, no setup required.\
- You can simply go to /backup to backup your current database
- And /restore to restore the exported .zip files
Optional — Publish config (to customise behaviour)
Optional — Publish views (to customise the UI)
Views are published to resources/views/vendor/db-archive/. Your layout can extend or replace db-archive::layouts.app.
Views load Tailwind CSS and Alpine.js via CDN. No npm setup required.
Default behaviour
| Behaviour | Default |
|---|---|
| Auth required | Yes — routes use web + auth middleware |
| Role required | super_admin (via Spatie Laravel Permission) |
| Storage paths | storage/backup/ (CSV temp) and storage/app/backup/zip/ (zip archives) |
| Route prefix | None — routes sit at /backup, /restore |
Authentication & role access
Out of the box, all routes require an authenticated user with the super_admin role (via spatie/laravel-permission).
Quick role setup
Add the HasRoles trait to your User model:
Create the role and assign to a user:
Bypassing or customising auth / roles
You have full control via the published config. Run:
Then edit config/db-archive.php:
If you use a completely different authorisation system, you can also point the routes to your own controller classes:
Your custom controllers must implement the same public methods as the originals. Extend the package controllers and override only what you need:
Configuration reference
Published config config/db-archive.php:
Override paths via .env:
Routes
| Method | URI | Name |
|---|---|---|
| GET | /backup |
backup.index |
| GET | /backup/tables |
backup.tables |
| POST | /backup/export |
backup.export |
| POST | /backup/zip |
backup.zip |
| GET | /backup/download/{fileName} |
backup.download |
| DELETE | /backup/{fileName} |
backup.delete |
| GET | /restore |
restore.index |
| POST | /backup/restore |
backup.restore |
All routes are wrapped in the middleware group from config('db-archive.middleware_group') plus a backup-role check.
Change any route path in the published config without touching the route file.
Usage
Via browser
Visit /backup to see available tables, export them, and manage zip files.
Visit /restore to upload a zip, view chunked CSVs grouped by table, and restore data.
Via API
Using PHP
Storage
Backup CSVs and zip files are stored in storage_path(config('db-archive.backup_path')) and storage_path(config('db-archive.zip_path')) respectively — outside public/ by default. Downloads are served through Laravel, not directly by the web server.
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- blalmal10a
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of db-archive with dependencies
ext-zip Version *
illuminate/contracts Version ^11.0||^12.0||^13.0
spatie/laravel-package-tools Version ^1.83