From e9cbf8227d76a1f33ff1d7db3b3388fae1357b2b Mon Sep 17 00:00:00 2001 From: James Titcumb Date: Wed, 4 Nov 2026 19:32:47 +0000 Subject: [PATCH] Add libssh2 --- docs/extension-maintainers.md | 1 + .../PhpBinaryPathBasedPlatformRepository.php | 1 + .../DependencyInstaller/SystemDependenciesDefinition.php | 7 +++++++ .../PhpBinaryPathBasedPlatformRepositoryTest.php | 2 ++ .../DependencyInstaller/PrescanSystemDependenciesTest.php | 5 +++++ 5 files changed, 16 insertions(+) diff --git a/docs/extension-maintainers.md b/docs/extension-maintainers.md index e809daa9..9308cee9 100644 --- a/docs/extension-maintainers.md +++ b/docs/extension-maintainers.md @@ -425,6 +425,7 @@ is NOT working, then please [report a bug](https://github.com/php/pie/issues). | lib-imagemagick | ✅ | apt, apk, dnf | | lib-event | ✅ | apt, apk, dnf | | lib-openssl | ✅ | apt, apk, dnf | +| lib-ssh2 | ✅ | apt, apk, dnf | #### Checking the extension will work diff --git a/src/ComposerIntegration/PhpBinaryPathBasedPlatformRepository.php b/src/ComposerIntegration/PhpBinaryPathBasedPlatformRepository.php index de2adbd7..0d192438 100644 --- a/src/ComposerIntegration/PhpBinaryPathBasedPlatformRepository.php +++ b/src/ComposerIntegration/PhpBinaryPathBasedPlatformRepository.php @@ -73,6 +73,7 @@ class PhpBinaryPathBasedPlatformRepository extends PlatformRepository 'imagemagick' => 'MagickWand', 'event' => 'libevent', 'openssl' => 'openssl', + 'ssh2' => 'libssh2', ]; private VersionParser $versionParser; diff --git a/src/DependencyResolver/DependencyInstaller/SystemDependenciesDefinition.php b/src/DependencyResolver/DependencyInstaller/SystemDependenciesDefinition.php index 705e39a0..e67a0945 100644 --- a/src/DependencyResolver/DependencyInstaller/SystemDependenciesDefinition.php +++ b/src/DependencyResolver/DependencyInstaller/SystemDependenciesDefinition.php @@ -146,6 +146,13 @@ public static function default(): self PackageManager::Microdnf->value => 'pkgconfig(openssl)', PackageManager::Yum->value => 'pkgconfig(openssl)', ], + 'ssh2' => [ + PackageManager::Apt->value => 'libssh2-1-dev', + PackageManager::Apk->value => 'libssh2-dev', + PackageManager::Dnf->value => 'pkgconfig(libssh2)', + PackageManager::Microdnf->value => 'pkgconfig(libssh2)', + PackageManager::Yum->value => 'pkgconfig(libssh2)', + ], ]); } } diff --git a/test/unit/ComposerIntegration/PhpBinaryPathBasedPlatformRepositoryTest.php b/test/unit/ComposerIntegration/PhpBinaryPathBasedPlatformRepositoryTest.php index 56ed7f05..30970654 100644 --- a/test/unit/ComposerIntegration/PhpBinaryPathBasedPlatformRepositoryTest.php +++ b/test/unit/ComposerIntegration/PhpBinaryPathBasedPlatformRepositoryTest.php @@ -230,6 +230,7 @@ public static function librariesDetectedUsingPkgConfig(): array 'imagemagick' => ['imagemagick', 'MagickWand', '6.9.12'], 'event' => ['event', 'libevent', '2.1.12-stable'], 'openssl' => ['openssl', 'openssl', '3.0.13'], + 'ssh2' => ['ssh2', 'libssh2', '1.11.0'], ]; } @@ -299,6 +300,7 @@ public static function installedLibraries(): array ['imagemagick', 'MagickWand'], ['event', 'libevent'], ['openssl', 'openssl'], + ['ssh2', 'libssh2'], ], static function (array $pkg): bool { try { diff --git a/test/unit/DependencyResolver/DependencyInstaller/PrescanSystemDependenciesTest.php b/test/unit/DependencyResolver/DependencyInstaller/PrescanSystemDependenciesTest.php index 64fdade8..fff0c5ca 100644 --- a/test/unit/DependencyResolver/DependencyInstaller/PrescanSystemDependenciesTest.php +++ b/test/unit/DependencyResolver/DependencyInstaller/PrescanSystemDependenciesTest.php @@ -468,6 +468,11 @@ public static function defaultDefinitions(): array 'openssl with dnf' => ['openssl', PackageManager::Dnf, 'pkgconfig(openssl)'], 'openssl with microdnf' => ['openssl', PackageManager::Microdnf, 'pkgconfig(openssl)'], 'openssl with yum' => ['openssl', PackageManager::Yum, 'pkgconfig(openssl)'], + 'ssh2 with apt' => ['ssh2', PackageManager::Apt, 'libssh2-1-dev'], + 'ssh2 with apk' => ['ssh2', PackageManager::Apk, 'libssh2-dev'], + 'ssh2 with dnf' => ['ssh2', PackageManager::Dnf, 'pkgconfig(libssh2)'], + 'ssh2 with microdnf' => ['ssh2', PackageManager::Microdnf, 'pkgconfig(libssh2)'], + 'ssh2 with yum' => ['ssh2', PackageManager::Yum, 'pkgconfig(libssh2)'], ]; }