mirror of
https://github.com/ivuorinen/phpenv.fish.git
synced 2026-02-27 16:55:57 +00:00
* feat: add Ubuntu support via provider-based architecture Implement multi-system support using a provider pattern that enables phpenv to work with both Homebrew (macOS/Linux) and APT (Ubuntu/Debian with Ondřej Surý PPA). - Add provider infrastructure with auto-detection and PHPENV_PROVIDER override - Refactor existing Homebrew code into __phpenv_provider_homebrew_* functions - Implement APT provider with PPA setup, shim-based version switching - Update doctor, versions, and help commands to be provider-aware - Use XDG-compliant shim directory (~/.local/share/phpenv/shims) * fix: address PR #112 code review feedback - Fix semver parsing for complex constraints like ">=8.1 <9.0" - Add input validation for APT commands to prevent injection - Use atomic symlink creation to prevent race conditions - Fix extension uninstall to mirror install package mappings - Replace unsafe glob with explicit binary list in cleanup - Remove redundant PATH filtering logic - Validate PHPENV_PROVIDER against supported providers - Use exact matching for Homebrew tap names - Use Fish's string escape for regex escaping * fix: validate dpkg output before passing to sudo apt-get Validates package names follow Debian naming rules before using them in the sudo apt-get remove command. This prevents potential command injection if dpkg output contains unexpected characters. Addresses remaining Copilot feedback from PR #112.
45 lines
1.4 KiB
Fish
45 lines
1.4 KiB
Fish
# phpenv configuration file
|
|
# Place in ~/.config/fish/conf.d/phpenv.fish
|
|
|
|
# Set default configuration using session variables for most settings
|
|
# Only PHPENV_GLOBAL_VERSION needs to persist across shells
|
|
|
|
# Provider override (empty = auto-detect)
|
|
# Valid values: homebrew, apt
|
|
if not set -q PHPENV_PROVIDER
|
|
set -g PHPENV_PROVIDER ""
|
|
end
|
|
|
|
if not set -q PHPENV_AUTO_INSTALL
|
|
set -g PHPENV_AUTO_INSTALL false
|
|
end
|
|
|
|
if not set -q PHPENV_AUTO_INSTALL_EXTENSIONS
|
|
set -g PHPENV_AUTO_INSTALL_EXTENSIONS false
|
|
end
|
|
|
|
if not set -q PHPENV_AUTO_SWITCH
|
|
set -g PHPENV_AUTO_SWITCH true
|
|
end
|
|
|
|
if not set -q PHPENV_DEFAULT_EXTENSIONS
|
|
set -g PHPENV_DEFAULT_EXTENSIONS "opcache"
|
|
end
|
|
|
|
# Initialize PATH on shell startup if global version is set (less aggressive)
|
|
if test -n "$PHPENV_GLOBAL_VERSION"; and not set -q PHPENV_INITIALIZED
|
|
if functions -q __phpenv_is_version_installed __phpenv_set_php_path
|
|
if __phpenv_is_version_installed "$PHPENV_GLOBAL_VERSION" 2>/dev/null
|
|
# Only set PATH if no project-specific version is detected
|
|
if not __phpenv_find_version_file .php-version >/dev/null 2>&1
|
|
if not __phpenv_find_version_file .tool-version >/dev/null 2>&1
|
|
if not test -f composer.json
|
|
__phpenv_set_php_path "$PHPENV_GLOBAL_VERSION" 2>/dev/null
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
set -g PHPENV_INITIALIZED true
|
|
end
|