PHPackages                             zbateson/mmp-crypt-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. [Mail &amp; Notifications](/categories/mail)
4. /
5. zbateson/mmp-crypt-gpg

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

zbateson/mmp-crypt-gpg
======================

PGP/MIME implementation of zbateson/mmp-crypt using PEAR Crypt\_GPG

1.0.0(4mo ago)12BSD-2-ClausePHPPHP &gt;=8.1

Since Feb 13Pushed 4mo agoCompare

[ Source](https://github.com/zbateson/mmp-crypt-gpg)[ Packagist](https://packagist.org/packages/zbateson/mmp-crypt-gpg)[ RSS](/packages/zbateson-mmp-crypt-gpg/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

zbateson/mmp-crypt-gpg
======================

[](#zbatesonmmp-crypt-gpg)

PGP/MIME encryption, decryption, signing, and verification for [zbateson/mail-mime-parser](https://github.com/zbateson/mail-mime-parser) using PEAR's [Crypt\_GPG](https://github.com/pear/Crypt_GPG).

[![Total Downloads](https://camo.githubusercontent.com/3ba9147a6362829c595a13251f869fb2a15047a5ad6e72738085dc767d90f27e/68747470733a2f2f706f7365722e707567782e6f72672f7a62617465736f6e2f6d6d702d63727970742d6770672f646f776e6c6f616473)](//packagist.org/packages/zbateson/mmp-crypt-gpg)[![Latest Stable Version](https://camo.githubusercontent.com/4f506aebb948e648646f74c42f7241de06b8c5b9e3f01bc9baf5337c177cc00c/68747470733a2f2f706f7365722e707567782e6f72672f7a62617465736f6e2f6d6d702d63727970742d6770672f76)](//packagist.org/packages/zbateson/mmp-crypt-gpg)

```
composer require zbateson/mmp-crypt-gpg

```

Sponsors
--------

[](#sponsors)

[![SecuMailer](https://camo.githubusercontent.com/74de27677ddf07fa571fcca6558d34be0fa6486bf473de73261461b89b12e8c5/68747470733a2f2f6d61696c2d6d696d652d7061727365722e6f72672f73706f6e736f72732f6c6f676f2d736563756d61696c65722e706e67)](https://secumailer.com)

A huge thank you to [all my sponsors](https://github.com/sponsors/zbateson). &lt;3

If this project's helped you, please consider [sponsoring me](https://github.com/sponsors/zbateson).

Requirements
------------

[](#requirements)

PHP 8.1 or newer with the `gpg` binary available on the system, and [zbateson/mail-mime-parser](https://github.com/zbateson/mail-mime-parser) 4.x. A configured GnuPG keyring with the appropriate keys imported is also required — see the [GnuPG documentation](https://gnupg.org/documentation/) for details on setting up your keyring.

Description
-----------

[](#description)

This package provides a PGP/MIME implementation of [zbateson/mmp-crypt](https://github.com/zbateson/mmp-crypt) using PEAR's Crypt\_GPG. It supports:

- Encrypting and decrypting `multipart/encrypted; protocol="application/pgp-encrypted"` messages
- Signing and verifying detached `application/pgp-signature` signatures
- Composing PGP/MIME messages via the `PgpMimeMessage` static API (encrypt, sign, sign-then-encrypt)

All operations use file-based I/O via temp files, so large messages are handled without loading them entirely into memory.

Usage
-----

[](#usage)

### Composing an encrypted message

[](#composing-an-encrypted-message)

```
use ZBateson\MailMimeParser\Message;
use ZBateson\MmpCryptGpg\GpgPear;
use ZBateson\MmpCryptGpg\PgpMimeMessage;

$message = Message::from($rawEmail, false);

$cryptGpg = new \Crypt_GPG();
$cryptGpg->addEncryptKey('recipient@example.com');
$crypt = new GpgPear($cryptGpg);

// Encrypt -- returns a new IMimePart with multipart/encrypted structure
$encrypted = PgpMimeMessage::encrypt($message, $crypt);

// The outer Subject defaults to "..." to hide the real subject
echo (string) $encrypted;
```

### Composing a signed message

[](#composing-a-signed-message)

```
$cryptGpg = new \Crypt_GPG();
$cryptGpg->addSignKey('sender@example.com');
$crypt = new GpgPear($cryptGpg);

$signed = PgpMimeMessage::sign($message, $crypt);
```

### Sign-then-encrypt

[](#sign-then-encrypt)

```
$cryptGpg = new \Crypt_GPG();
$cryptGpg->addSignKey('sender@example.com');
$cryptGpg->addEncryptKey('recipient@example.com');
$crypt = new GpgPear($cryptGpg);

$result = PgpMimeMessage::signAndEncrypt($message, $crypt);
```

### Decrypting a parsed message

[](#decrypting-a-parsed-message)

```
use ZBateson\MmpCryptGpg\GpgPear;

$cryptGpg = new \Crypt_GPG();
// Keys must be in the GnuPG keyring for decryption
$crypt = new GpgPear($cryptGpg);

$decrypted = $crypt->decrypt($encryptedPart->getContentStream());
```

License
-------

[](#license)

BSD licensed - please see [license agreement](https://github.com/zbateson/mmp-crypt-gpg/blob/master/LICENSE).

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance74

Regular maintenance activity

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

141d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f2d1f00c58c63c29cc0fcf5972c9add3d468fb126f7191a6a5dfabc1f0af24e4?d=identicon)[zbateson](/maintainers/zbateson)

---

Top Contributors

[![zbateson](https://avatars.githubusercontent.com/u/8356974?v=4)](https://github.com/zbateson "zbateson (1 commits)")

---

Tags

encryptionmimeemailPGPgpgmail-mime-parser

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/zbateson-mmp-crypt-gpg/health.svg)

```
[![Health](https://phpackages.com/badges/zbateson-mmp-crypt-gpg/health.svg)](https://phpackages.com/packages/zbateson-mmp-crypt-gpg)
```

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.3k543.5M2.6k](/packages/aws-aws-sdk-php)[algolia/algoliasearch-client-php

API powering the features of Algolia.

69735.1M159](/packages/algolia-algoliasearch-client-php)[zbateson/mail-mime-parser

MIME email message parser

54753.3M91](/packages/zbateson-mail-mime-parser)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M737](/packages/sylius-sylius)[gotenberg/gotenberg-php

A PHP client for interacting with Gotenberg, a developer-friendly API for converting numerous document formats into PDF files, and more!

3856.2M31](/packages/gotenberg-gotenberg-php)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)

PHPackages © 2026

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