nowo-tech / site-backup-bundle
Symfony bundle for integral website backups with checksum integrity and a safe restore UI (loading page) that does not break the app mid-restore.
Package info
github.com/nowo-tech/SiteBackupBundle
Type:symfony-bundle
pkg:composer/nowo-tech/site-backup-bundle
Requires
- php: >=8.2 <8.6
- symfony/config: ^7.0 || ^8.0
- symfony/console: ^7.0 || ^8.0
- symfony/dependency-injection: ^7.0 || ^8.0
- symfony/event-dispatcher: ^7.0 || ^8.0
- symfony/filesystem: ^7.0 || ^8.0
- symfony/finder: ^7.0 || ^8.0
- symfony/http-foundation: ^7.0 || ^8.0
- symfony/http-kernel: ^7.0 || ^8.0
- symfony/process: ^7.0 || ^8.0
- symfony/routing: ^7.0 || ^8.0
- symfony/security-core: ^7.0 || ^8.0
- symfony/security-csrf: ^7.0 || ^8.0
- symfony/yaml: ^7.0 || ^8.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- nowo-tech/phpstan-frankenphp: ^1.0
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-symfony: ^2.0
- phpunit/phpunit: ^10.0
- rector/rector: ^2.0
- symfony/framework-bundle: ^7.0 || ^8.0
- symfony/twig-bundle: ^7.0 || ^8.0
- twig/twig: ^3.12
Suggests
- doctrine/dbal: Optional; used when database dump_command is not set and a DBAL connection is available
- symfony/flex: For automatic recipe installation
- symfony/security-bundle: Optional; wire a custom SiteBackupAccessGateInterface
- symfony/translation: Required for |trans in panel and restore templates
- symfony/twig-bundle: Required to render the restore loading page and admin panel
README
⭐ Found this useful? Install from Packagist · Give it a star on GitHub so more developers can find it.
Site Backup Bundle — Create an integral website backup (selected paths + optional DB dump + SHA-256 MANIFEST.json), restore it safely behind a loading page UI, and finish cold bootstrap with a setup wizard (DB, migrations, admin, sample data). Tested on Symfony 7.4, 8.0, and 8.1 · PHP 8.2+ (Symfony 8.x requires PHP 8.4+).
This bundle is FrankenPHP worker mode friendly.
Features
- Integral backup — Configurable include paths, exclude patterns, optional
database_dump_command,.tar.gz+ sidecar metadata. - Integrity — Per-file SHA-256 in
MANIFEST.jsonplus archive SHA-256;verifybefore restore. - Safe restore — Validate → extract to staging → apply with protected paths → progress JSON;
var/site-backup/never overwritten mid-restore. - Loading page — While restore is active,
kernel.requestreturns HTTP 503 with a progress UI (polls/_site_backup/progress.json); panel stays reachable. - Setup wizard — Cold start / post-restore: create DB, migrations/schema, minimal SQL, idempotent loaders, super-admin, optional sample data — see docs/SETUP-WIZARD.md.
- Admin panel — Create / verify / restore / delete under
/_site_backup(password gate + CSRF). - CLI —
create,list,verify,restore,setup,setup-status,setup-reset,hash-password.
Installation
composer require nowo-tech/site-backup-bundle
With Symfony Flex, the recipe registers the bundle and config. Without Flex, see docs/INSTALLATION.md.
# config/routes.yaml nowo_site_backup: resource: '@NowoSiteBackupBundle/Resources/config/routes.yaml'
Requirements
- PHP
>=8.2(<8.6); Symfony 8.0 and 8.1 require PHP 8.4+ - Symfony 7.4, 8.0, or 8.1 (minimum supported minors; also works on Symfony 7.0–7.3 via
composer.jsonconstraints) taravailable on the host/container for archive create/extract- Twig for the restore page, panel, and setup wizard templates
Configuration
nowo_site_backup: enabled: true backup: include_paths: [config, public, templates, src, composer.json, composer.lock] database_dump_command: '%env(default::SITE_BACKUP_DUMP_CMD)%' panel: path_prefix: '/_site_backup' security: password_protection: true password_hash: '%env(SITE_BACKUP_PASSWORD_HASH)%' setup: admin_provisioner: App\Setup\AdminUserProvisioner
Usage
php bin/console nowo:site-backup:create -l "pre-deploy" php bin/console nowo:site-backup:verify <id> php bin/console nowo:site-backup:restore <id> -y
Open /_site_backup to manage backups from the UI. During restore, visitors see the loading page; the panel and progress endpoint keep working. For cold DB / post-restore, open /_setup (see docs/SETUP-WIZARD.md).
See docs/USAGE.md.
Demo
| Demo | Symfony | PHP | Default port |
|---|---|---|---|
demo/symfony8 |
8.1 | 8.5 | 8056 |
Runs FrankenPHP + Caddy (FRANKENPHP_MODE=worker by default). See docs/DEMO-FRANKENPHP.md.
make -C demo help
make -C demo up-symfony8
Development
make up
make install
make test
make cs-check
make phpstan
make release-check
Documentation
- Installation
- Configuration
- Usage
- Contributing
- Code of Conduct
- Changelog
- Upgrading
- Release
- Security
- Engram
- Spec-driven development
- GitHub Spec Kit
Additional documentation
Tests and coverage
- Tests: PHPUnit (PHP)
- PHP: 99.4% Lines (gate ≥ 99% via
make coverage-check) - Residual OS/defensive branches: see docs/COVERAGE.md
License and author
MIT · Nowo.tech
