Download the PHP package onamfc/laravel-database-archiver without Composer
On this page you can find all versions of the php package onamfc/laravel-database-archiver. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-database-archiver
Laravel Database Archiver
A comprehensive Laravel package for efficient database record archival to cold storage systems like AWS S3, with support for multiple formats and automated scheduling.
Features
- Multi-storage Support: AWS S3, local filesystem, and extensible for other providers
- Multiple Formats: JSON and Parquet export formats
- Configurable Criteria: Flexible record selection based on age, status, or custom conditions
- Scheduled Archival: Integration with Laravel Task Scheduler
- Memory Efficient: Processes large datasets in configurable chunks
- Comprehensive Logging: Detailed operation logs and database tracking
- Artisan Commands: Easy-to-use CLI interface
- Multi-table Support: Archive multiple tables with different configurations
Installation
Install the package via Composer:
Publish the configuration file:
Publish and run the migrations:
Configuration
Configure your archival settings in config/db-archiver.php
:
Basic Storage Configuration
Table Configuration
Environment Variables
Add these to your .env
file:
Usage
Artisan Commands
Archive a Single Table
Archive All Configured Tables
Check Archival Status
Programmatic Usage
Scheduled Archival
The package automatically registers scheduled tasks based on your table configurations. The following schedules are supported:
daily
- Runs daily at midnightweekly
- Runs weekly on Sunday at midnightmonthly
- Runs monthly on the 1st at midnight- Custom cron expressions (e.g.,
0 2 * * *
for 2 AM daily)
Advanced Configuration
Custom Criteria Values
You can use dynamic values in your criteria:
Multiple Criteria
Custom Storage Paths
Use dynamic placeholders in storage paths:
Storage Adapters
AWS S3
Local Storage
Data Formats
JSON Format
Stores data as formatted JSON files:
Parquet Format
Stores data in Parquet format for efficient compression and analytics.
Monitoring and Logging
Database Logging
All archival operations are logged to the archive_logs
table:
File Logging
Operations are also logged to your configured log channel:
Error Handling
The package includes comprehensive error handling:
- Storage connectivity issues
- Invalid configurations
- Data transformation errors
- Permission problems
- Memory limitations
Errors are logged and can trigger notifications if configured.
Security Considerations
- Use IAM roles with minimal required permissions for S3 access
- Enable server-side encryption for stored archives
- Regularly rotate access keys
- Monitor access logs for archived data
- Consider using S3 bucket policies for additional security
Performance Optimization
- Adjust
chunk_size
based on your available memory - Use appropriate S3 storage classes (Standard-IA, Glacier)
- Schedule archival during low-traffic periods
- Monitor database performance during archival operations
- Consider using database indexes on archival criteria columns
Testing
All versions of laravel-database-archiver with dependencies
illuminate/support Version ^10.0|^11.0
illuminate/console Version ^10.0|^11.0
illuminate/database Version ^10.0|^11.0
aws/aws-sdk-php Version ^3.0
league/flysystem-aws-s3-v3 Version ^3.0