PHPackages                             athens/encryption - 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. athens/encryption

ActivePropel-behavior

athens/encryption
=================

Propel Behavior for seamless encryption/decryption of data columns

0.3.3(10y ago)05463[3 issues](https://github.com/AthensFramework/encryption/issues)[1 PRs](https://github.com/AthensFramework/encryption/pulls)PHP

Since Aug 20Pushed 4y ago1 watchersCompare

[ Source](https://github.com/AthensFramework/encryption)[ Packagist](https://packagist.org/packages/athens/encryption)[ RSS](/packages/athens-encryption/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)Dependencies (5)Versions (13)Used By (0)

[![Build Status](https://camo.githubusercontent.com/827ef5ae78dca16207860a55dc7f656932ee7c4f938693215053fd6ce0914ed3/68747470733a2f2f7472617669732d63692e6f72672f417468656e734672616d65776f726b2f656e6372797074696f6e2e737667)](https://travis-ci.org/AthensFramework/encryption)[![Code Climate](https://camo.githubusercontent.com/47e7894e8c24c833b72d0be0abb9008664703c951e17057b4e13aa06f5cace7f/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f417468656e734672616d65776f726b2f656e6372797074696f6e2f6261646765732f6770612e737667)](https://codeclimate.com/github/AthensFramework/encryption)[![Test Coverage](https://camo.githubusercontent.com/1ccb7416e29f78e82da51390c61b59e7b6d231bc89109644d50f2e0c5ba1c57d/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f417468656e734672616d65776f726b2f656e6372797074696f6e2f6261646765732f636f7665726167652e737667)](https://codeclimate.com/github/AthensFramework/encryption/coverage)[![Latest Stable Version](https://camo.githubusercontent.com/cdfa683a0ea15429c9b6f081aef3a0fe5a21ef5a2931f70b67fe383235e57d92/68747470733a2f2f706f7365722e707567782e6f72672f417468656e732f456e6372797074696f6e2f762f737461626c65)](https://packagist.org/packages/Athens/Encryption)

Athens\\Encryption
==================

[](#athensencryption)

Seamlessly encrypt/decrypt Propel2 data fields. This library is a *plugin* for the [Propel2 ORM framework](http://propelorm.org/).

For example:

```
// schema.xml

// Before any database queries:

    use Athens\Encryption\Cipher;
    Cipher::createInstance("mysecretpassphrase");

// In your program:

    $o = new MyClass();

    $o->setMyData("Some data that will remain as plain text.");
    $o->setMySecretData("Some data that will be encrypted.");

    $o->save();

// Later:

    $o = MyClassQuery::create()->findOneByMyData("Some data that will remain as plain text.");

    echo $o->getMySecretData();
    // "Some data that will be encrypted."

```

Given the table definition above, the string `"Some data that will be encrypted."` is encrypted in memory before being sent to the database. When we retrieve `MySecretData` later, the ciphertext is decrypted before being returned.

Note/Tradeoff
=============

[](#notetradeoff)

Athens/Encryption *breaks Propel's native search/find/sort* methods on the encrypted field(s). Because the plain-texts of encrypted fields are not available to the database, no database method of search or sort can operate on these fields. A search or sort can only be accomplished by *retrieving all rows*, decrypting all values, and performing a search/sort on those. If you have many rows and you need to search/sort on encrypted fields, this process may be impractically slow.

Installation
============

[](#installation)

This library is published on packagist. To install using Composer, add the `"Athens/Encryption": "0.1.*"` line to your "require" dependencies:

```
{
    "require": {
        "Athens/Encryption": ">=0.1"
    }
}

```

Of course, if you're not using Composer then you can download the repository using the *Download ZIP* button at right.

Use
===

[](#use)

This client library provides a `Cipher` class and one Propel2 Behavior class.

To designate a field as encrypted in your Propel schema, set its type as `varbinary` and include the `encryption` behavior. You may include multiple columns in the `encryption` behavior:

```

```

Then build your models and database as usual.

Before querying the database, you must initialize the Cipher class with your passphrase:

```
    // Intialize the cipher
    Cipher::createInstance($my_passphrase);

```

The argument `$my_passphrase` should be a string of random characters. A length of 32-64 characters is appropriate for your passphrase. Because the cipher is initialized with every page load, the passphrase must be stored on your server in a location accessible to PHP. However, the passphrase should *not* be in a file which is viewable to web-visitors, and it almost certainly should not be included in your source/version control (git, scm, etc.).

That's it! The class setters for `MySecretData` and `MySecretData2` now seamlessly encrypt their data before it is sent to the database. The class getters for `MySecretData` and `MySecretData2` seamlessly decrypt data after retrieving it from the database.

Remember that search/find and sort are now *broken* for `MySecretData` and `MySecretData2`, for reasons discussed above.

Compatibility
=============

[](#compatibility)

- PHP 5.5, 5.6, 7.0
- Propel2

Todo
====

[](#todo)

See GitHub [issue tracker](https://github.com/AthensFramework/encryption/issues/).

Getting Involved
================

[](#getting-involved)

Feel free to open pull requests or issues. [GitHub](https://github.com/AthensFramework/encryption) is the canonical location of this project.

Here's the general sequence of events for code contribution:

1. Open an issue in the [issue tracker](https://github.com/AthensFramework/encryption/issues/).
2. In any order:

- Submit a pull request with a **failing** test that demonstrates the issue/feature.
- Get acknowledgement/concurrence.

3. Revise your pull request to pass the test in (2). Include documentation, if appropriate.

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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

Every ~17 days

Recently: every ~23 days

Total

12

Last Release

3727d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2b43989ce7a387c05c59282788d15171a28abf61e02614a7a005cb19ef8da2b4?d=identicon)[JASchilz](/maintainers/JASchilz)

![](https://www.gravatar.com/avatar/290ab676b0d7a71324f5e5b1cd29b339cd379449c10bb721fd3f7d7d6b7571f1?d=identicon)[BonPacific](/maintainers/BonPacific)

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

---

Top Contributors

[![JASchilz](https://avatars.githubusercontent.com/u/6137968?v=4)](https://github.com/JASchilz "JASchilz (52 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/athens-encryption/health.svg)

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

PHPackages © 2026

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