my-env/install/php-tools-only
2022-12-10 21:59:01 +08:00

42 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
##makedesc: Install phpunit + psalm + phpcs + php-cs-fixer
echo
echo "==============================================="
echo "Installing phpunit + psalm + phpcs + php-cs-fixer..."
echo "==============================================="
echo
installed() {
command -v "$1" >/dev/null 2>&1
}
! installed "php" && echo "ERROR: You need php to be installed" && exit 1
! installed "composer" && echo "ERROR: You need composer to be installed" && exit 2
composer global require phpunit/phpunit --dev
composer global require phpmd/phpmd --dev
composer global require squizlabs/php_codesniffer --dev
composer global require friendsofphp/php-cs-fixer --dev
composer global require vimeo/psalm --dev
composer global require phpstan/phpstan --dev
# composer global require phpunit/dbunit
# composer global require phing/phing
# composer global require phpdocumentor/phpdocumentor
# composer global require sebastian/phpcpd
# composer global require phploc/phploc
export PATH="$(composer config -g home)/vendor/bin:${PATH}"
echo 'export PATH="$(composer config -g home)/vendor/bin:${PATH}"' >> "${HOME}/.profile"
phpunit --version
phpmd --version
phpcs --version # phpcbf --version
php-cs-fixer --version
psalm --version
phpstan --version
echo
echo "Finish!"
echo