phpseclib

Pure-PHP implementations of SSH2, SFTP, X.509, RSA, AES, and dozens of other cryptographic primitives

Library
Composer
v3.0.56
5,586stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
94/100Excellent
Development Activity100
Maintenance96
Community80
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
83/100Excellent
Architecture88
Code Quality90
Innovation82
Learning Curve70

phpseclib is a pure-PHP cryptography and secure-communications library that has served as the de facto standard for SSH, SFTP, and X.509 handling in the PHP ecosystem since 2012. It implements SSH-2 and SFTP clients, X.509 certificate parsing and generation, an arbitrary-precision integer arithmetic library, and a wide range of symmetric and asymmetric ciphers including RSA, DSA, DH, ECDSA/ECDH (66 curves), Ed25519/Ed449, AES, Blowfish, Twofish, ChaCha20, and Salsa20 — all without requiring PHP’s OpenSSL extension, though it will use OpenSSL when available for speed.

With over 5,500 GitHub stars, 191 contributors, and roughly 10 million monthly Composer downloads, it underpins SSH/SFTP functionality in projects ranging from WordPress plugins to enterprise deployment tooling. The library maintains parallel long-term-support branches (1.0 through the upcoming 4.0) so that legacy PHP 5.3 codebases and modern PHP 8.1+ applications can both depend on a stable, security-audited implementation.

What You Get

  • SSH-2 client with exec, shell, port-forwarding, and agent-forwarding support
  • SFTP client for uploading, downloading, and managing remote files over SSH
  • X.509 certificate, CRL, and CSR parsing and generation (split into dedicated classes in 4.0)
  • Asymmetric crypto: RSA (PKCS#1 v2.2), DSA, DH, ECDSA/ECDH across 66 curves, Ed25519/Ed449
  • Symmetric ciphers: AES, Rijndael, Blowfish, Twofish, DES/3DES, RC2/RC4, ChaCha20, Salsa20, with GCM and Poly1305 AEAD modes
  • An arbitrary-precision BigInteger engine with pluggable math backends (GMP, BCMath, pure-PHP)
  • ASN.1 encoding/decoding used internally by the X.509 and public-key modules

Common Use Cases

  • Automating SFTP file transfers and remote command execution from PHP deployment scripts
  • Parsing and validating X.509 certificates for TLS client verification or internal PKI tooling
  • Signing and verifying data with RSA/ECDSA when a hosting environment lacks the OpenSSL extension
  • Generating and managing SSH key pairs (RSA, Ed25519, ECDSA) programmatically

Under The Hood

Architecture — phpseclib organizes code under phpseclib/phpseclib3 (with legacy phpseclib1/phpseclib2 namespaces on older LTS branches) into Crypt (symmetric and asymmetric ciphers), Net (SSH2/SFTP protocol clients), File (ASN.1 and X.509 parsing), Math (BigInteger with pluggable engines), Common, and System. Each cipher lives in its own class (e.g. Crypt/AES.php, Crypt/RSA.php) with shared engine-selection logic that transparently falls back between pure-PHP, GMP, and OpenSSL implementations depending on what the host PHP build has available.

Tech Stack — Pure PHP 8.1+ with only two runtime dependencies: paragonie/constant_time_encoding for timing-safe encoding and symfony/polyfill-php82 for forward compatibility. Development tooling includes PHPUnit 13 (via brianium/paratest for parallel test runs), PHP_CodeSniffer, php-parallel-lint, and Vimeo’s Psalm for static analysis — a notably rigorous toolchain for a pure-PHP crypto library.

Code Quality — 67 test files under tests/Unit and tests/Functional cover each crypto primitive and protocol client individually (tests/Unit/Crypt, tests/Unit/Net, tests/Unit/Math, tests/Unit/File), plus a PsalmBaselineTest enforcing static-analysis regressions don’t creep in. A SECURITY.md and Tidelift-coordinated disclosure process reflect the seriousness expected of a crypto library; 191 contributors and 6,275 total commits indicate broad external review over its 14-year history.

API Design — The library favors small, purpose-built classes per algorithm (new RSA(), new AES('gcm')) over one monolithic crypto facade, which keeps usage explicit but requires consulting per-class docs for parameters like cipher mode. The parallel 1.0–4.0 branch strategy with distinct PSR-4 namespaces (\phpseclib3 etc.) lets consumers pin a stable major version without namespace collisions, at the cost of some documentation fragmentation across branches.

Used by 6 apps in this directory

PHP
79%
Apache 2.0

Coolify

Devops · Hosting Control Panel

60,738

Open-source self-hosted PaaS — deploy apps, databases and 280+ services on your own servers with no vendor lock-in

View details
92
Repo Health
86
Technical
72
Dependency
Built with
PHP79%
Blade18%
Updated yesterday
PHP
66%
AGPL 3.0

EspoCRM

Marketing · Ecommerce · CRM

3,259

Open-source CRM platform with metadata-driven customization, field-level permissions, and a full REST API — deploy on your own infrastructure.

View details
97
Repo Health
72
Technical
64
Dependency
Built with
PHP66%
JavaScript24%
Updated yesterday
PHP
48%
AGPL 3.0

Leantime

Productivity · Project Management · Collaboration

11,391

Project management built for ADHD, autism, and dyslexia — simple as Trello, powerful as Jira

View details
90
Repo Health
68
Technical
67
Dependency
Built with
PHP48%
CSS20%
Blade17%
Updated 4 days ago
JavaScript
44%
Other

LimeSurvey

Forms Surveys

3,698

The world's most flexible open-source survey platform with 900+ templates, conditional logic, 80+ languages, and full GDPR compliance for any scale.

View details
86
Repo Health
62
Technical
62
Dependency
Built with
JavaScript44%
PHP34%
CSS12%
Updated today
PHP
55%
AGPL 3.0

Pixelfed

Social Media

7,069

A decentralized, self-hosted photo sharing platform built on ActivityPub for the open Fediverse.

View details
86
Repo Health
68
Technical
69
Dependency
Built with
PHP55%
Vue32%
Blade13%
Updated yesterday
PHP
63%
AGPL 3.0

Vanguard Backup

Devops

37

Self-hosted backup automation for Ubuntu and Debian servers with S3 storage, SSH-based file and database backup, and multi-channel notifications.

View details
33
Repo Health
80
Technical
70
Dependency
Built with
PHP63%
Blade36%
Updated 9 months ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search