Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Backup Laravel Package

spatie/laravel-backup

Spatie Laravel Backup creates zip backups of your app files and database, storing them on any Laravel filesystem (even multiple). Includes health monitoring, notifications, and automatic cleanup of old backups. Run with php artisan backup:run.

View on GitHub
Deep Wiki
Context7

title: Adding extra files to a backup weight: 1

The package ships with a BackupManifestWasCreated event that enables you to add additional files to the backup zip file.

When backup process starts, the package will create a manifest of all file that are selected for backup. Once the manifest has been created, a zip file is made containing all the files in the manifest. The zip file will be copied to the backup destinations you configured.

However, if you have cases where you need to add additional files to a particular backup, you can do so, between the creation of the manifest and the creation of the zip file.

Right after the manifest is created and before the zip file is created the Spatie\Backup\Events\BackupManifestWasCreated event is fired. This is what is looks like:

namespace Spatie\Backup\Events;

use Spatie\Backup\Tasks\Backup\Manifest;

class BackupManifestWasCreated
{
    /** [@var](https://github.com/var) \Spatie\Backup\Tasks\Backup\Manifest */
    public $manifest;

    public function __construct(Manifest $manifest)
    {
        $this->manifest = $manifest;
    }
}

You can use that event to add extra files to the manifest as in the example below where the extra files are passed as an array to the addFiles() method.

use Spatie\Backup\Events\BackupManifestWasCreated;

Event::listen(BackupManifestWasCreated::class, function (BackupManifestWasCreated $event) {
   $event->manifest->addFiles([$path1, $path2, ...]);
});
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
babenkoivan/elastic-client
innmind/static-analysis
innmind/coding-standard
datacore/hub-sdk
alengo/sulu-http-cache-bundle
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
imbo/imbo-coding-standard
visualbuilder/filament-lottie
servicioslineaonce/starter-kit
atomcoder/laravel-reorderable
irajul/filament-shadcn-theme
agtp/agtp-php
agtp/mod-php
centraldesktop/protobuf-php