1. Go to this page and download the library: Download glueful/archive library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
glueful / archive example snippets
use Glueful\Extensions\Archive\ArchiveServiceInterface;
use Glueful\Extensions\Archive\DTOs\ArchiveSearchQuery;
use Glueful\Extensions\Archive\DTOs\ArchiveRestoreOptions;
$archive = app($context, ArchiveServiceInterface::class);
// Archive rows older than a cutoff
$result = $archive->archiveTable('audit_logs', new \DateTime('-90 days'));
// $result->archiveUuid, $result->recordCount, $result->fileSize, ...
// Search across archives
$results = $archive->searchArchives(new ArchiveSearchQuery(/* ... */));
// Restore an archive into its source table (or a target table)
$restore = $archive->restoreFromArchive($archiveUuid, new ArchiveRestoreOptions(
conflictResolution: 'skip', // or 'overwrite'
));
// Integrity & housekeeping
$archive->verifyArchive($archiveUuid);
$archive->deleteArchive($archiveUuid);
// Stats & planning
$archive->trackTableGrowth('audit_logs');
$stats = $archive->getTableStats('audit_logs');
$summary = $archive->getArchiveSummary();
$tables = $archive->getTablesNeedingArchival();
$list = $archive->getTableArchives('audit_logs');
bash
# Enable (adds the provider FQCN to config/extensions.php + recompiles the cache)
php glueful extensions:enable archive
# Disable (removes it)
php glueful extensions:disable archive