-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·43 lines (37 loc) · 1.17 KB
/
install.sh
File metadata and controls
executable file
·43 lines (37 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
# PHP Switch - Quick Installation Script
# Usage: curl -fsSL https://raw.githubusercontent.com/alanshijo/php-version-manager/main/install.sh | bash
set -e
echo "🐘 Installing PHP Switch..."
# Download the script
curl -fsSL -o ~/.php-switch https://raw.githubusercontent.com/alanshijo/php-version-manager/main/php-switch.sh
# Detect shell and config file
if [ -n "$ZSH_VERSION" ]; then
SHELL_CONFIG="$HOME/.zshrc"
SHELL_NAME="zsh"
elif [ -n "$BASH_VERSION" ]; then
SHELL_CONFIG="$HOME/.bashrc"
SHELL_NAME="bash"
else
SHELL_CONFIG="$HOME/.bashrc"
SHELL_NAME="bash"
fi
# Add source line if not already present
if ! grep -q "source ~/.php-switch" "$SHELL_CONFIG" 2>/dev/null; then
echo "" >> "$SHELL_CONFIG"
echo "# PHP Switch - PHP Version Manager" >> "$SHELL_CONFIG"
echo "source ~/.php-switch" >> "$SHELL_CONFIG"
echo "✅ Added to $SHELL_CONFIG"
else
echo "ℹ️ Already configured in $SHELL_CONFIG"
fi
echo ""
echo "✨ PHP Switch installed successfully!"
echo ""
echo "To start using it, run:"
echo " source $SHELL_CONFIG"
echo ""
echo "Or restart your terminal, then try:"
echo " php-switch --help"
echo " php-list"
echo ""