PHPackages                             phpseclib/phpseclib2\_compat - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. phpseclib/phpseclib2\_compat

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

phpseclib/phpseclib2\_compat
============================

phpseclib 2.0 polyfill built with phpseclib 3.0

1.0.10(2w ago)132.1M↓38%612MITPHPCI failing

Since Dec 19Pushed 2w ago1 watchersCompare

[ Source](https://github.com/phpseclib/phpseclib2_compat)[ Packagist](https://packagist.org/packages/phpseclib/phpseclib2_compat)[ Docs](https://github.com/phpseclib/phpseclib2_compat)[ RSS](/packages/phpseclib-phpseclib2-compat/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)Dependencies (8)Versions (13)Used By (12)

phpseclib2\_compat
==================

[](#phpseclib2_compat)

[![CI Status](https://github.com/phpseclib/phpseclib2_compat/actions/workflows/ci.yml/badge.svg?branch=master&event=push "CI Status")](https://github.com/phpseclib/phpseclib2_compat/actions/workflows/ci.yml?query=branch%3Amaster)

phpseclib 2.0 polyfill built with phpseclib 3.0

Overview
--------

[](#overview)

phpseclib 3.0 breaks backwards compatability with phpseclib 2.0. Most notably, public keys work completely differently. So let's say you wanted to use phpseclib 3.0 whilst some of your other dependencies still use phpseclib 2.0. What would you do in that instance?

That's where phpseclib2\_compat comes into play. Require phpseclib/phpseclib:~3.0 and phpseclib/phpseclib2\_compat:~1.0 and your dependencies will magically start using phpseclib 3.0 even if they don't know it.

Using phpseclib2\_compat will actually bring a few enhancements to your dependencies. For example, while phpseclib 2.0 only supports RSA keys phpseclib2\_compat sports support for ECDSA / DSA / Ed25519 / Ed449 keys.

Consider this code sample:

```
use phpseclib\Crypt\RSA;

$rsa = new RSA;
$rsa->loadKey('ecdsa private key');

$ssh = new SSH2('website.com');
$ssh->login('username', $rsa);
```

That'll work with phpseclib2\_compat, even with an ECDSA private key, whereas in phpseclib 2.0 it would not work.

SSH1 and SCP are not supported but those were likely never frequently used anyway.

Using the old cipher suite
--------------------------

[](#using-the-old-cipher-suite)

phpseclib 3.0 uses a different cipher suite (an expanded one) than 2.0. If this causes you issues you can use the 2.0 ciphersuite by doing this prior to calling `$ssh->login()`:

```
$methods = [
    'crypt' => array_intersect([
        'arcfour256',
        'arcfour128',
        'aes128-ctr',
        'aes192-ctr',
        'aes256-ctr',
        'twofish128-ctr',
        'twofish192-ctr',
        'twofish256-ctr',
        'aes128-cbc',
        'aes192-cbc',
        'aes256-cbc',
        'twofish128-cbc',
        'twofish192-cbc',
        'twofish256-cbc',
        'twofish-cbc',
        'blowfish-ctr',
        'blowfish-cbc',
        '3des-ctr',
        '3des-cbc'
    ], $ssh->getSupportedEncryptionAlgorithms()),
    'mac' => [
        'hmac-sha2-256',
        'hmac-sha1-96',
        'hmac-sha1',
        'hmac-md5-96',
        'hmac-md5'
    ],
    'comp' => ['none']
];

$ssh->setPreferredAlgorithms([
    'kex' => [
        'curve25519-sha256@libssh.org',
        'diffie-hellman-group-exchange-sha256',
        'diffie-hellman-group-exchange-sha1',
        'diffie-hellman-group14-sha1',
        'diffie-hellman-group14-sha256'
    ],
    'hostkey' => [
        'rsa-sha2-256',
        'rsa-sha2-512',
        'ssh-rsa',
        'ssh-dss'
    ],
    'client_to_server' => $methods,
    'server_to_client' => $methods
]);
```

Installation
------------

[](#installation)

With [Composer](https://getcomposer.org/):

```
composer require phpseclib/phpseclib2_compat:~1.0

```

###  Health Score

61

—

FairBetter than 99% of packages

Maintenance96

Actively maintained with recent releases

Popularity50

Moderate usage in the ecosystem

Community26

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 95.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~182 days

Recently: every ~21 days

Total

12

Last Release

17d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1214cf33299ce51f30c9c199cf3b55e8630cc16d5df714c551407088937e9988?d=identicon)[terrafrost](/maintainers/terrafrost)

---

Top Contributors

[![terrafrost](https://avatars.githubusercontent.com/u/214474?v=4)](https://github.com/terrafrost "terrafrost (80 commits)")[![adriano66](https://avatars.githubusercontent.com/u/3438696?v=4)](https://github.com/adriano66 "adriano66 (1 commits)")[![bilogic](https://avatars.githubusercontent.com/u/946010?v=4)](https://github.com/bilogic "bilogic (1 commits)")[![dhedberg](https://avatars.githubusercontent.com/u/279067?v=4)](https://github.com/dhedberg "dhedberg (1 commits)")[![jonlee90](https://avatars.githubusercontent.com/u/17611175?v=4)](https://github.com/jonlee90 "jonlee90 (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/phpseclib-phpseclib2-compat/health.svg)

```
[![Health](https://phpackages.com/badges/phpseclib-phpseclib2-compat/health.svg)](https://phpackages.com/packages/phpseclib-phpseclib2-compat)
```

###  Alternatives

[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751291.4k40](/packages/civicrm-civicrm-core)[phpseclib/mcrypt_compat

PHP 5.x-8.x polyfill for mcrypt extension

28131.4M42](/packages/phpseclib-mcrypt-compat)[akeneo/pim-community-dev

Akeneo PIM, the future of catalog management is open!

1.0k624.1k85](/packages/akeneo-pim-community-dev)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M560](/packages/shopware-core)[shopware/app-php-sdk

Shopware App SDK for PHP

15109.8k3](/packages/shopware-app-php-sdk)[n1ebieski/ksef-php-client

PHP API client that allows you to interact with the API Krajowego Systemu e-Faktur

9067.8k](/packages/n1ebieski-ksef-php-client)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
