Skip to content
/ phpsu Public

Phpsu: Synchronisation Utility: File and Database

License

Notifications You must be signed in to change notification settings

phpsu/phpsu

Repository files navigation

Phpsu: Synchronisation Utility: File and Database

Latest Version Software License Build Status Coverage Status Quality Score Total Downloads

This package is compliant with PSR-1, PSR-2 and PSR-4. If you notice compliance oversights, please send a patch via pull request.

Install

Via Composer:

composer require --dev phpsu/phpsu

Install with conflicting versions

If you have problems with conflicting versions. eg. symfony:2.* 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

Requirements

The following versions of PHP are supported by this version.

  • PHP 7.0, 7.1, 7.2 and 7.3
  • Compatible and continuously tested with symfony 3.2, 3.4 and 4.2

Required for synchronisation are:

  • ssh on execution System
  • rsync on executing System
  • mysqldump on source System
  • mysql on 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);

$config = new \PHPSu\Config\GlobalConfig();
$config->addFilesystem('Image Uploads', 'var/storage')
    ->addExclude('*.mp4')
    ->addExclude('*.mp3')
    ->addExclude('*.zip')
    ->addExcludes(['*.jpg', '*.gif']);
$config->addSshConnection('hostA', 'ssh://user@localhost:2208');
$config->addAppInstance('production', 'hostA', '/var/www/')
    ->addDatabase('app', 'mysql://root:[email protected]:3307/production01db')
    ->addExclude('table1')
    ->addExclude('table2')
    ->addExcludes(['table3', 'table4']);
$config->addAppInstance('local')
    ->addDatabase('app', 'mysql://root:[email protected]/testingLocal');
return $config;

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 [email protected]:phpsu/phpsu.git
cd phpsu
composer install

Testing

composer test

You can also check, whether any changes you made are affecting your tests immediatly 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

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.