feat: add Ubuntu support via provider-based architecture (#112)

* 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.
This commit is contained in:
2026-01-24 21:04:52 +02:00
committed by GitHub
parent 00db5127c8
commit dbce6f9fa3
2 changed files with 896 additions and 191 deletions

File diff suppressed because it is too large Load Diff