From 4b6e8962ca017adfa4777576811de132e9641ee1 Mon Sep 17 00:00:00 2001 From: Brosseau Valentin Date: Sun, 10 Aug 2025 20:45:47 +0200 Subject: [PATCH] Better PHP dev-env init (#624) * Extract logic to avoid adding composer in the path multiple times and add Symfony * Add missing usage * Use the official script to install Symfony installer * Use AUR package * Move PHP and Composer install in function to avoid duplication. * Add explicit usage for symfony-cli --------- Co-authored-by: David Heinemeier Hansson --- bin/omarchy-install-dev-env | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/bin/omarchy-install-dev-env b/bin/omarchy-install-dev-env index 25eafe1b..fa37e8f7 100755 --- a/bin/omarchy-install-dev-env +++ b/bin/omarchy-install-dev-env @@ -1,10 +1,22 @@ #!/bin/bash if [[ -z "$1" ]]; then - echo "Usage: omarchy-instal-dev-env " >&2 + echo "Usage: omarchy-instal-dev-env " >&2 exit 1 fi +install_php() { + yay -Sy php composer --noconfirm + + if [[ ":$PATH:" != *":$HOME/.config/composer/vendor/bin:"* ]]; then + echo 'export PATH="$HOME/.config/composer/vendor/bin:$PATH"' >> "$HOME/.bashrc" + source "$HOME/.bashrc" + echo "Added Composer global bin directory to PATH." + else + echo "Composer global bin directory already in PATH." + fi +} + case "$1" in ruby) echo -e "Installing Ruby on Rails...\n" @@ -30,13 +42,21 @@ go) ;; laravel) echo -e "Installing PHP and Laravel...\n" - yay -S php composer --noconfirm + install_php composer global require laravel/installer - echo 'export PATH="$HOME/.config/composer/vendor/bin:$PATH"' >>"$HOME/.bashrc" - source "$HOME/.bashrc" echo "PHP, Composer, and Laravel have been installed successfully." echo "You can now run: laravel new myproject" ;; +symfony) + echo -e "Installing PHP and Symfony...\n" + install_php + yay -S symfony-cli --noconfirm + echo "PHP, Composer, and Symfony CLI have been installed successfully." + echo "If you are building a traditional web application:" + echo "symfony new --webapp my_project" + echo "If you are building a microservice, console application or API:" + echo "symfony new my_project" + ;; python) echo -e "Installing Python...\n" mise use --global python@latest