Giter Club home page Giter Club logo

shellcommandbuilder's Introduction

Phpsu: Synchronisation Utility: File and Database

Latest Version Software License Coverage Status Infection MSI Total Downloads

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

read more about docker usage

Requirements

The following versions of PHP are supported by this version.

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);

$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 [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 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 [email protected] instead of using the issue tracker.

Credits

License

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

shellcommandbuilder's People

Contributors

chrisb9 avatar dshoreman avatar kanti avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

dshoreman

shellcommandbuilder's Issues

Remove `--ignore-platform-reqs` from Composer commands in Travis builds

Once updates are available to add php 8 support (see below), $COMPOSER_OPTS can be removed from the install command along with the one remaining env: COMPOSER_OPTS... line in .travis.yml:

- php: nightly
dist: bionic
env: COMPOSER_OPTS="--ignore-platform-reqs"
cache:
directories:
- $HOME/.composer/cache
install:
- travis_retry composer install $COMPOSER_OPTS

Before this can happen, some deps need to be updated. That's partially beyond our control, so it was left out of #17.

Required changes upstream

As far as I can tell, the only updates we're waiting for are in phpunit-watcher, grumphp-config and (by proxy) grumphp.

spatie/phpunit-watcher

PHP 8 support is merged, but not yet released. #17 sets the requirement to "^1.24 || dev-master#071fbbf" as a workaround.

Assuming the next version is 1.24, we can drop || dev-master#... once it's released.

pluswerk/grumphp-config

This was updated for composer 2 support in 4.0.1, but upstream currently lacks PHP 8 support.

  • pluswerk/grumphp-config should require grumphp ^0.19 || ^1.X to maintain 7.2 support
    (replace X with whichever version adds php 8 support - 1.1 doesn't have it yet)
  • phpro/grumphp needs to allow >=7.3 or ^7.3 || ^8.0, but currently locks to ^7.3

Escaping of arguments has to be done on toString

Currently escapeshellarg is not applied to inline-commands that are passed as arguments
Producing something like this

-  'rsync·-vvv·-az·-e·'ssh·-F·'\''php://temp'\'''·'hosta:/var/www/prod/var/storage/'·'./var/storage/''
+ 'rsync·-vvv·-az·-e·ssh·-F·'php://temp'·'hosta:/var/www/prod/var/storage/'·'./var/storage/''

escaping should just be applied when everything is accessed for the final result

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.