Weave 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

Backup Database Laravel Package

salvatorecervone/backup-database

A Laravel package for backing up your database with ease. salvatorecervone/backup-database provides simple commands and configuration to create, store, and manage database backups, helping you protect application data with minimal setup.

View on GitHub
Deep Wiki
Context7

Getting Started

Install with Composer and confirm the service provider is auto-discovered; publish the package config if the README instructs it. Start by reviewing the package’s filesystem driver config and the smb disk example, then add a disk in config/filesystems.php:

'smb' => [
    'driver' => 'smb',
    'host' => env('SMB_HOST'),
    'share' => env('SMB_SHARE'),
    'username' => env('SMB_USERNAME'),
    'password' => env('SMB_PASSWORD'),
    'domain' => env('SMB_DOMAIN'),
    'root' => env('SMB_ROOT', ''),
],

First use case: use it like any Laravel disk.

Storage::disk('smb')->put('reports/q1.pdf', $pdfContents);
Storage::disk('smb')->exists('reports/q1.pdf');

For 2.0.7 specifically, verify paths that were previously written as UNC paths such as \\server\share\folder\file.txt. Prefer configuring host/share/root and using relative paths like folder/file.txt.

Implementation Patterns

  • Treat the SMB disk as a normal Laravel filesystem disk. Inject Storage::disk('smb') or resolve FilesystemManager rather than using the adapter directly.
  • Centralize path handling. Add a small helper that converts any legacy UNC input to the relative SMB path expected by the disk, especially after the 2.0.7 UNC-to-SMB route fix.
  • Use streams for large files: readStream, writeStream, and putFileAs avoid loading entire files into memory.
  • Use the disk inside queued jobs for sync/export workflows, with retries and explicit exception handling around connection and permission failures.
  • Keep credentials in .env and environment-specific config. Run php artisan config:clear after changing SMB settings, especially in cached deployments.
  • For testability, fake the disk where possible (Storage::fake('smb')) or bind a test double around the filesystem manager if the adapter cannot be faked directly.
  • Audit existing workarounds. If older code manually rewrote UNC paths before calling the disk, remove that logic and test against 2.0.7 to avoid double conversion.

Gotchas and Tips

  • 2.0.7 fixes routing from UNC to SMB. Re-test any code that passes absolute UNC paths; the fix may change behavior for paths that previously required manual normalization.
  • Avoid mixing absolute UNC paths and relative disk paths in the same codebase. Pick one convention: configure the share/root once and use relative paths everywhere.
  • SMB permissions are two-layered: share permissions and filesystem/NTFS permissions. A successful connection does not guarantee write or delete access.
  • Debug with the underlying Flysystem exception message and the disk adapter. Log the configured host/share/root, but never log passwords.
  • Config caching can hide stale credentials. Clear and rebuild config cache during deployment.
  • Extension points are usually the filesystem driver config and Flysystem adapter options. If you need custom retry, timeout, or path-normalization behavior, wrap the disk in a small service rather than scattering workarounds through controllers.
  • Do not commit SMB credentials. Use secrets management and restrict the SMB service account to only the shares and folders the application needs.
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.
abbasudo/artisan-route
mirvan/ippanel
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package