PHPackages                             exonet/securemessage - 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. [Security](/categories/security)
4. /
5. exonet/securemessage

ActiveLibrary[Security](/categories/security)

exonet/securemessage
====================

Encrypt and decrypt messages in a secure way.

v1.0.2(4y ago)1627.0k—7.1%MITPHPPHP ^7.3|^8.0CI passing

Since Jul 6Pushed 2mo ago8 watchersCompare

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

READMEChangelog (6)Dependencies (2)Versions (9)Used By (0)

SecureMessage
=============

[](#securemessage)

[![Latest Version on Packagist](https://camo.githubusercontent.com/24024d403184b1f9bdbd0e01889faac87934aacdd6dca413c67eba90d275c2ee/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f65786f6e65742f7365637572656d6573736167652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/exonet/securemessage)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/7ab8ac62dd0b405847bdbbbd74f603f838db3132c0adef217b5fe903cab5d629/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f65786f6e65742f7365637572656d6573736167652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/exonet/securemessage)

This package makes it possible to create (very) secure messages and store them in, for example, your database. A secure message is encrypted with a combination of three key 'parts':

- A "database key" - to be saved in a database.
- A "storage key" - to be stored on a disk/filesystem.
- A "verification code" - this code should *not* be stored anywhere.

This way, if an attacker has access to the database, it still has only access to a small part of the complete key. The same goes if an attacker has access to the file storage. Even if an attacker has access to the database *and* the file storage, a part of the complete key is still missing.

The verification code can be sent (securely) to the receiver of the secure message and with this code, it can decrypt the message and read it.

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

[](#requirements)

This package requires at least PHP 7.3 with the [sodium](https://www.php.net/manual/en/sodium.installation.php) extension enabled.

Install
-------

[](#install)

Via Composer

```
$ composer require exonet/securemessage
```

Usage
-----

[](#usage)

```
// Create the factory.
$secureMessageFactory = new Exonet\SecureMessage\Factory();
// Set the (application wide) meta key.
$secureMessageFactory->setMetaKey('A_10_random_characters_long_key.');

// Create a new SecureMessage. Note: it is not encrypted yet!
$secureMessage = $secureMessageFactory->make('Hello, world!');
// Encrypt the Secure Message.
$encryptedMessage = $secureMessage->encrypt();
```

Please see the `/docs` folder for complete documentation and additional examples.

Change log
----------

[](#change-log)

Please see [releases](https://github.com/exonet/securemessage/releases) for more information on what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](.github/CODE_OF_CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Exonet](https://github.com/exonet)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance58

Moderate activity, may be stable

Popularity34

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~261 days

Recently: every ~322 days

Total

6

Last Release

1566d ago

Major Versions

v0.1.2 → v1.0.02021-11-04

PHP version history (2 changes)v0.1.0PHP ~7.1

v1.0.0PHP ^7.3|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/9c233226e0fbf5dd5e3f42f3e1b832a51a825d08ca0d9e58abaf10c29740a9ba?d=identicon)[exonet](/maintainers/exonet)

---

Top Contributors

[![robbinjanssen](https://avatars.githubusercontent.com/u/120077?v=4)](https://github.com/robbinjanssen "robbinjanssen (31 commits)")[![trizz](https://avatars.githubusercontent.com/u/832056?v=4)](https://github.com/trizz "trizz (25 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (14 commits)")[![styxit](https://avatars.githubusercontent.com/u/1370548?v=4)](https://github.com/styxit "styxit (5 commits)")[![robinmulder](https://avatars.githubusercontent.com/u/120075?v=4)](https://github.com/robinmulder "robinmulder (3 commits)")[![petervmeijgaard](https://avatars.githubusercontent.com/u/5537701?v=4)](https://github.com/petervmeijgaard "petervmeijgaard (1 commits)")[![rsplithof](https://avatars.githubusercontent.com/u/805008?v=4)](https://github.com/rsplithof "rsplithof (1 commits)")[![jesperweiland](https://avatars.githubusercontent.com/u/372359?v=4)](https://github.com/jesperweiland "jesperweiland (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/exonet-securemessage/health.svg)

```
[![Health](https://phpackages.com/badges/exonet-securemessage/health.svg)](https://phpackages.com/packages/exonet-securemessage)
```

###  Alternatives

[defuse/php-encryption

Secure PHP Encryption Library

3.9k162.4M214](/packages/defuse-php-encryption)[mews/purifier

Laravel 5/6/7/8/9/10 HtmlPurifier Package

2.0k16.7M113](/packages/mews-purifier)[robrichards/xmlseclibs

A PHP library for XML Security

41478.1M118](/packages/robrichards-xmlseclibs)[bjeavons/zxcvbn-php

Realistic password strength estimation PHP library based on Zxcvbn JS

87117.5M63](/packages/bjeavons-zxcvbn-php)[illuminate/encryption

The Illuminate Encryption package.

9229.7M280](/packages/illuminate-encryption)[paragonie/hidden-string

Encapsulate strings in an object to hide them from stack traces

7410.6M39](/packages/paragonie-hidden-string)

PHPackages © 2026

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