Fix missing defaults PHP extensions to create Laravel Project (#630)

* Fix missing default PHP extensions to create laravel Project

* iconv is required for Symfony project

* Add PHP only installation

* Add PHP only option in the menu
This commit is contained in:
Brosseau Valentin 2025-08-10 22:12:21 +02:00 committed by GitHub
parent 7d3d7e264b
commit 5be5dede6b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 24 additions and 3 deletions

View File

@ -1,13 +1,14 @@
#!/bin/bash #!/bin/bash
if [[ -z "$1" ]]; then if [[ -z "$1" ]]; then
echo "Usage: omarchy-instal-dev-env <ruby|node|bun|go|laravel|symfony|python|elixir|rust|java|ocaml|dotnet>" >&2 echo "Usage: omarchy-instal-dev-env <ruby|node|bun|go|laravel|symfony|php|python|elixir|rust|java|ocaml|dotnet>" >&2
exit 1 exit 1
fi fi
install_php() { install_php() {
yay -Sy php composer --noconfirm yay -Sy php composer php-sqlite --noconfirm
# Install Path for Composer
if [[ ":$PATH:" != *":$HOME/.config/composer/vendor/bin:"* ]]; then if [[ ":$PATH:" != *":$HOME/.config/composer/vendor/bin:"* ]]; then
echo 'export PATH="$HOME/.config/composer/vendor/bin:$PATH"' >>"$HOME/.bashrc" echo 'export PATH="$HOME/.config/composer/vendor/bin:$PATH"' >>"$HOME/.bashrc"
source "$HOME/.bashrc" source "$HOME/.bashrc"
@ -15,6 +16,21 @@ install_php() {
else else
echo "Composer global bin directory already in PATH." echo "Composer global bin directory already in PATH."
fi fi
# Enable some extensions
local php_ini_path="/etc/php/php.ini"
local extensions_to_enable=(
"bcmath"
"intl"
"iconv"
"openssl"
"pdo_sqlite"
"pdo_mysql"
)
for ext in "${extensions_to_enable[@]}"; do
sudo sed -i "s/^;extension=${ext}/extension=${ext}/" "$php_ini_path"
done
} }
case "$1" in case "$1" in
@ -41,6 +57,10 @@ go)
echo -e "Installing Go...\n" echo -e "Installing Go...\n"
mise use --global go@latest mise use --global go@latest
;; ;;
php)
echo -e "Installing PHP...\n"
install_php
;;
laravel) laravel)
echo -e "Installing PHP and Laravel...\n" echo -e "Installing PHP and Laravel...\n"
install_php install_php

View File

@ -262,7 +262,8 @@ show_install_javascript_menu() {
} }
show_install_php_menu() { show_install_php_menu() {
case $(menu "Install" " Laravel\n Symfony") in case $(menu "Install" " PHP\n Laravel\n Symfony") in
*PHP*) present_terminal "omarchy-install-dev-env php" ;;
*Laravel*) present_terminal "omarchy-install-dev-env laravel" ;; *Laravel*) present_terminal "omarchy-install-dev-env laravel" ;;
*Symfony*) present_terminal "omarchy-install-dev-env symfony" ;; *Symfony*) present_terminal "omarchy-install-dev-env symfony" ;;
*) show_install_development_menu ;; *) show_install_development_menu ;;