phpsu / phpsu
Synchronisation Utility: File and Database
Requires
- php: ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0
- composer-runtime-api: ^2.0.0
- ext-json: *
- phpsu/shellcommandbuilder: ^2.0
- symfony/console: ^5.0 || ^6.0 || ^7.0
- symfony/process: ^5.0 || ^6.0 || ^7.0
Requires (Dev)
- infection/infection: ^0.28.1 || ^0.29.14
- phpunit/phpunit: ^10.5.18 || ^12.1.6
- pluswerk/grumphp-config: ^7.0.1 || ^10.1.3
Suggests
- bamarni/composer-bin-plugin: Dependency-Independent use of phpsu
- dev-main
- 4.3.0
- 4.2.1
- 4.2.0
- 4.1.4
- 4.1.3
- 4.1.2
- 4.1.1
- 4.1.0
- 4.0.1
- 4.0.0
- 3.1.0
- 3.0.5
- 3.0.4
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0.0
- 2.3.0
- 2.2.1
- 2.2.0
- 2.1.0
- 2.0.1
- 2.0.0
- 2.0.0-rc1
- 1.1.0
- 1.0.0
- 1.0.0-beta5
- 1.0.0-beta4
- 1.0.0-beta3
- 1.0.0-beta2
- 1.0.0-beta1
- 1.0.0-alpha3
- 1.0.0-alpha2
- 1.0.0-alpha1
- dev-new-phpsu
- dev-feature/dependency-injection
- dev-feature/extend-info-command
- dev-feature/init-command
This package is auto-updated.
Last update: 2026-03-23 11:17:33 UTC
README
This package is compliant with PSR-1, PSR-2, PSR-4 and PSR-12. If you notice compliance oversights, please send a patch via pull request.
Install
Via Composer:
composer require --dev phpsu/phpsu
Via Composer, with conflicting versions
If you have problems with conflicting versions eg. symfony:<5 you can use the composer-bin-plugin.
composer require --dev bamarni/composer-bin-plugin composer bin phpsu require --dev phpsu/phpsu # we recommend to install it with the auto installation scripts: composer config scripts.bin "echo 'bin not installed'" composer config scripts.post-install-cmd '@composer bin all install --ansi' composer config scripts.post-update-cmd '@composer bin all update --ansi' echo '/vendor-bin/**/vendor' >> .gitignore
Via Docker:
if you want to use phpsu via Docker we have a minimal phpsu docker image: phpsu/phpsu.
you can execute any phpsu command via something like this:
docker run --rm -it -u $(id -u):$(id -g) -v $(pwd):/app -v ~/.ssh:/home/phpsu/.ssh phpsu/phpsu:latest phpsu ssh production
Requirements
The following versions of PHP are supported by this version.
- PHP
8.1,8.2,8.3 - Compatible and continuously tested with symfony
5,6,7 - for older versions go to version 3.1.0
- for older versions go to version 2.3.0
- or version 1.1.0
Required for synchronisation are:
bashon execution System (and the ssh user needs to have a shell whereset -o pipefailis possible (eg. not sh on debian as that is dash and does not work))sshon execution Systemrsyncon executing Systemmysqldumpon source Systemmysqlon destination Systems
Unfortunately we do not support Windows yet.
Documentation
The full Documentation can be found in the /docs Directory.
Configuration Example
Simple configuration example phpsu-config.php:
<?php declare(strict_types=1); $globalConfig = new \PHPSu\Config\GlobalConfig(); $globalConfig->addFilesystem('Image Uploads', 'var/storage') ->addExclude('*.mp4') ->addExclude('*.mp3') ->addExclude('*.zip') ->addExcludes(['*.jpg', '*.gif']); $globalConfig->addSshConnection('hostA', 'ssh://user@localhost:2208'); $globalConfig->addAppInstance('production', 'hostA', '/var/www/') ->addDatabase('app', 'production01db', 'root', 'password', '127.0.0.1', 3307) ->addExclude('one_single_table_name') ->addExclude('/cache/') ->addExclude('/session$/') ->addExcludes(['/log/']); $globalConfig->addAppInstance('local') ->addDatabase('app', 'testingLocal', 'root', 'root'); return $globalConfig;
CLI Examples
phpsu sync production --dry-run phpsu sync p --no-db phpsu sync p --no-fs phpsu sync production testing --all
Contributing
install for Contribution
git clone git@github.com:phpsu/phpsu.git
cd phpsu
composer install
Testing
composer test
You can also check, whether any changes you made are affecting your tests immediately on save:
composer test:watch
If you see a low Mutation Score Indicator (MSI) value, you can show the mutations that are escaping:
composer infection -- -s
If you have an unwanted BC break in your Pull Request you can run the same test locally with docker:
docker run --rm -v `pwd`:/app nyholm/roave-bc-check --format=markdown > results.md
Security
If you discover any security related issues, please email git@kanti.de instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.