Skip to content

Commit 08e0b47

Browse files
committed
feat(php): add PHP catalog with PPA and update Composer dependency
- Add catalog/php.json with: - package_manager install method - ondrej/php PPA for latest PHP on Ubuntu/Debian - Support for apt, brew, dnf, pacman - Guide order 250 (before Composer) - Update catalog/composer.json: - Add "requires": ["php"] field - Add guide section with order 260 - Update install_composer.sh: - Check for PHP before installation - Auto-install PHP if missing via package_manager.sh - Provide manual installation instructions on failure
1 parent 38babaf commit 08e0b47

3 files changed

Lines changed: 53 additions & 0 deletions

File tree

catalog/composer.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,11 @@
77
"github_repo": "composer/composer",
88
"binary_name": "composer",
99
"script": "install_composer.sh",
10+
"requires": ["php"],
11+
"guide": {
12+
"display_name": "Composer",
13+
"install_action": "install",
14+
"order": 260
15+
},
1016
"notes": "Installed from latest stable phar (https://getcomposer.org/download/latest-stable/composer.phar). Requires PHP."
1117
}

catalog/php.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "php",
3+
"category": "php",
4+
"install_method": "package_manager",
5+
"description": "PHP programming language",
6+
"homepage": "https://www.php.net",
7+
"github_repo": "php/php-src",
8+
"binary_name": "php",
9+
"ppa": "ondrej/php",
10+
"packages": {
11+
"apt": "php php-cli php-mbstring php-xml php-curl php-zip",
12+
"brew": "php",
13+
"dnf": "php php-cli php-mbstring php-xml",
14+
"pacman": "php"
15+
},
16+
"version_flag": "--version",
17+
"guide": {
18+
"display_name": "PHP",
19+
"install_action": "install",
20+
"order": 250
21+
},
22+
"notes": "Uses ondrej/php PPA for latest PHP version on Ubuntu/Debian. Required for Composer."
23+
}

scripts/install_composer.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,33 @@
33
# Downloads latest stable composer.phar and installs to /usr/local/bin
44
set -euo pipefail
55

6+
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7+
68
INSTALL_DIR="${COMPOSER_INSTALL_DIR:-/usr/local/bin}"
79
COMPOSER_URL="https://getcomposer.org/download/latest-stable/composer.phar"
810

11+
# Check for PHP dependency
12+
if ! command -v php >/dev/null 2>&1; then
13+
echo "[composer] Error: PHP is required but not installed." >&2
14+
echo "[composer] Install PHP first using one of:" >&2
15+
echo " - sudo apt-get install php php-cli (Debian/Ubuntu)" >&2
16+
echo " - brew install php (macOS)" >&2
17+
echo " - ./install_tool.sh php (via this toolset)" >&2
18+
19+
# Try to install PHP automatically if we can
20+
if [ -f "$DIR/installers/package_manager.sh" ]; then
21+
echo "[composer] Attempting to install PHP automatically..." >&2
22+
if "$DIR/installers/package_manager.sh" php; then
23+
echo "[composer] PHP installed successfully, continuing with Composer..." >&2
24+
else
25+
echo "[composer] Failed to install PHP automatically. Please install manually." >&2
26+
exit 1
27+
fi
28+
else
29+
exit 1
30+
fi
31+
fi
32+
933
echo "[composer] Downloading latest stable composer.phar..."
1034

1135
# Download to temp file

0 commit comments

Comments
 (0)