Created
July 5, 2019 09:49
-
-
Save ctudorache87/684868da0db61e617434d7140f138fe7 to your computer and use it in GitHub Desktop.
WSL PHP and Node development environment Bash aliases and functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias update='sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y && sudo apt clean' | |
alias ..="cd .." | |
alias ...="cd ../.." | |
alias h='cd ~' | |
alias c='clear' | |
alias art=artisan | |
alias codecept='vendor/bin/codecept' | |
alias phpspec='vendor/bin/phpspec' | |
alias xoff='sudo phpdismod -s cli xdebug' | |
alias xon='sudo phpenmod -s cli xdebug' | |
alias nrd="npm run dev" | |
alias nrw="npm run watch" | |
alias nrwp="npm run watch-poll" | |
alias nrh="npm run hot" | |
alias nrp="npm run production" | |
alias yrd="yarn run dev" | |
alias yrw="yarn run watch" | |
alias yrwp="yarn run watch-poll" | |
alias yrh="yarn run hot" | |
alias yrp="yarn run production" | |
function artisan() { | |
php artisan "$@" | |
} | |
function php56() { | |
sudo update-alternatives --set php /usr/bin/php5.6 | |
sudo update-alternatives --set php-config /usr/bin/php-config5.6 | |
sudo update-alternatives --set phpize /usr/bin/phpize5.6 | |
} | |
function php70() { | |
sudo update-alternatives --set php /usr/bin/php7.0 | |
sudo update-alternatives --set php-config /usr/bin/php-config7.0 | |
sudo update-alternatives --set phpize /usr/bin/phpize7.0 | |
} | |
function php71() { | |
sudo update-alternatives --set php /usr/bin/php7.1 | |
sudo update-alternatives --set php-config /usr/bin/php-config7.1 | |
sudo update-alternatives --set phpize /usr/bin/phpize7.1 | |
} | |
function php72() { | |
sudo update-alternatives --set php /usr/bin/php7.2 | |
sudo update-alternatives --set php-config /usr/bin/php-config7.2 | |
sudo update-alternatives --set phpize /usr/bin/phpize7.2 | |
} | |
function php73() { | |
sudo update-alternatives --set php /usr/bin/php7.3 | |
sudo update-alternatives --set php-config /usr/bin/php-config7.3 | |
sudo update-alternatives --set phpize /usr/bin/phpize7.3 | |
} | |
function xphp() { | |
(php -m | grep -q xdebug) | |
if [[ $? -eq 0 ]] | |
then | |
XDEBUG_ENABLED=true | |
else | |
XDEBUG_ENABLED=false | |
fi | |
if ! $XDEBUG_ENABLED; then xon; fi | |
HOST_IP=$(last --limit=1 | grep -oP '\d+(\.\d+){3}') | |
php \ | |
-dxdebug.remote_host=${HOST_IP} \ | |
-dxdebug.remote_autostart=1 \ | |
"$@" | |
if ! $XDEBUG_ENABLED; then xoff; fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment