- Can I use this bundle directly in Laravel without Symfony?
- No, this is a Symfony bundle, but you can integrate it via the spatie/laravel-symfony bridge or wrap its logic in custom Laravel Artisan commands. The core functionality (remote dump mounting) remains accessible this way.
- What Laravel versions does this bundle support?
- The bundle itself targets Symfony, but Laravel 8.x+ can integrate it via spatie/laravel-symfony (tested with Laravel 8/9). For Laravel 7, you’d need manual DI container adjustments. Always check the Symfony bridge’s Laravel compatibility.
- How do I configure SMB/SFTP credentials securely in Laravel?
- Store credentials in Laravel’s `.env` file (e.g., `SMB_USERNAME`, `SFTP_PRIVATE_KEY`) and bind them to the bundle’s configuration via `config/mountlast.php`. Use environment variables to avoid hardcoding. The bundle relies on league/flysystem for remote handling.
- Will this work with PostgreSQL or only MySQL?
- The bundle supports any database compatible with Doctrine DBAL (MySQL, PostgreSQL, SQLite). However, ensure your dumps match the target DB’s dialect—e.g., PostgreSQL UUIDs vs. MySQL CHAR(36). Test with a sample dump before full deployment.
- How do I test remote file system failures in Laravel?
- Mock the remote adapter (e.g., `league/flysystem`) using Laravel’s `Mockery` or `PHPUnit`. Replace the real filesystem with a `InMemoryFilesystem` or `LocalFilesystem` in tests. Validate error handling for connection drops or missing files.
- Can I schedule this to run nightly via Laravel’s scheduler?
- Yes, wrap the bundle’s commands in Laravel Artisan tasks and schedule them in `app/Console/Kernel.php`. Example: `Schedule::command('mountlast:mount')->nightly()`. Add pre/post hooks (e.g., cache clearing) via Laravel’s events.
- What if my SQL dump is >10GB? Will this handle large files?
- The bundle streams dumps by default, but for multi-GB files, test chunked SQL execution or parallel processing. Monitor memory usage—large dumps may require `php.ini` adjustments (e.g., `memory_limit`). Consider compressing dumps further if network bandwidth is a concern.
- Are there Laravel-native alternatives to this bundle?
- For Laravel-only solutions, consider spatie/laravel-backup (for local/remote backups) or custom scripts using spatie/flysystem + DBAL. However, this bundle uniquely handles remote SMB/SFTP dumps with built-in mounting logic, reducing boilerplate.
- How do I handle schema differences between production and test DBs?
- Use Doctrine DBAL’s schema tools to compare schemas before mounting. For Laravel, extend the bundle’s logic to run `php artisan migrate:fresh` post-mount or apply custom SQL transformations. Audit collations, UUID types, and engine settings (e.g., InnoDB vs. MyISAM).
- What’s the best way to validate dump integrity before mounting?
- Calculate checksums (MD5/SHA-256) of remote dumps and compare them to local copies. Add a Laravel command to verify checksums via `hash_file()` before decompression. For critical workflows, log checksum mismatches to a monitoring tool like Laravel Horizon.