PHPackages                             jasonhinkle/php-gpg - 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. jasonhinkle/php-gpg

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

jasonhinkle/php-gpg
===================

GPG / PGP port written in pure PHP with no binary dependencies

1.6.4(10y ago)116147.2k↓27.1%271GPLPHP

Since Nov 27Pushed 9y ago19 watchersCompare

[ Source](https://github.com/jasonhinkle/php-gpg)[ Packagist](https://packagist.org/packages/jasonhinkle/php-gpg)[ RSS](/packages/jasonhinkle-php-gpg/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (1)Versions (8)Used By (1)

php-gpg
=======

[](#php-gpg)

**This project is currently not actively maintained, please take a look at  as alternative.**

php-gpg is a pure PHP implementation of GPG/PGP (currently supports encryption only). The library does not require PGP/GPG binaries and should run on any platform that supports PHP.

This library is useful for encrypting data before it is sent over an insecure protocol (for example email). Messages encrypted with this library are compatible and can be decrypted by standard GPG/PGP clients.

Features/Limitations
--------------------

[](#featureslimitations)

- Supports RSA, DSA public key length of 2,4,8,16,512,1024,2048 or 4096
- Currently supports only encrypt
- Encrypted messages are integrity protected (php-gpg 1.6.0+)

Hey You! If you have a good understanding of public key encryption and want to implement signing or decryption your pull request would be welcome.

Composer
--------

[](#composer)

If you use PHP &lt; 7.0, please install random\_compat with Composer.

Just run `php composer.phar install` or `composer install` in the directory of the composer.json file.

Usage
-----

[](#usage)

```
require __DIR__ . '/vendor/autoload.php';
require_once 'libs/GPG.php';

$gpg = new GPG();

// create an instance of a GPG public key object based on ASCII key
$pub_key = new GPG_Public_Key($public_key_ascii);

// using the key, encrypt your plain text using the public key
$encrypted = $gpg->encrypt($pub_key,$plain_text_string);

echo $encrypted;
```

License
-------

[](#license)

GPL

I'd like to release this under a more permissive license, but since PGP &amp; GPG itself are GPL, I think this library is likely bound to the terms of GPL as well.

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity49

Moderate usage in the ecosystem

Community23

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 68.8% 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 ~16 days

Total

6

Last Release

3741d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/313176?v=4)[Jason Hinkle](/maintainers/jasonhinkle)[@jasonhinkle](https://github.com/jasonhinkle)

---

Top Contributors

[![DanielRuf](https://avatars.githubusercontent.com/u/827205?v=4)](https://github.com/DanielRuf "DanielRuf (64 commits)")[![jasonhinkle](https://avatars.githubusercontent.com/u/313176?v=4)](https://github.com/jasonhinkle "jasonhinkle (27 commits)")[![r--w](https://avatars.githubusercontent.com/u/1191700?v=4)](https://github.com/r--w "r--w (1 commits)")[![singpolyma](https://avatars.githubusercontent.com/u/12770?v=4)](https://github.com/singpolyma "singpolyma (1 commits)")

---

Tags

gpg

### Embed Badge

![Health badge](/badges/jasonhinkle-php-gpg/health.svg)

```
[![Health](https://phpackages.com/badges/jasonhinkle-php-gpg/health.svg)](https://phpackages.com/packages/jasonhinkle-php-gpg)
```

###  Alternatives

[hidehalo/nanoid-php

A copy of nanoid in PHP

8124.1M41](/packages/hidehalo-nanoid-php)[paragonie/random-lib

A Library For Generating Secure Random Numbers

703.3M26](/packages/paragonie-random-lib)[gpslab/base64uid

Generate UID like YouTube

68103.4k](/packages/gpslab-base64uid)[wyrihaximus/react-child-process-messenger

Messenger decorator for react/child-process

32279.4k4](/packages/wyrihaximus-react-child-process-messenger)[andrewcarteruk/cryptokey

A command line tool for generating keys using a CSPRNG.

6124.2k](/packages/andrewcarteruk-cryptokey)

PHPackages © 2026

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