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

ActivePropel-behavior[Security](/categories/security)

chybadapi/encryption
====================

Propel Behavior for seamless encryption/decryption of data columns

0.3.5(3y ago)043PHP

Since Aug 20Pushed 3y agoCompare

[ Source](https://github.com/chybaDapi/Encryption)[ Packagist](https://packagist.org/packages/chybadapi/encryption)[ RSS](/packages/chybadapi-encryption/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (2)Dependencies (5)Versions (15)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)

chybaDapi\\Encryption (a fork of Athens\\Encryption)
====================================================

[](#chybadapiencryption-a-fork-of-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": {
        "chybaDapi/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.X
- 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

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 91.2% 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 ~195 days

Recently: every ~588 days

Total

14

Last Release

1378d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0dcc2a1139a746a8c9ae88b7a0df744cab3d2d4937ce72708060684ae4386581?d=identicon)[Dapi](/maintainers/Dapi)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[defuse/php-encryption

Secure PHP Encryption Library

3.9k162.4M214](/packages/defuse-php-encryption)[roave/security-advisories

Prevents installation of composer packages with known security vulnerabilities: no API, simply require it

2.9k97.3M6.4k](/packages/roave-security-advisories)[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

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

Realistic password strength estimation PHP library based on Zxcvbn JS

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

The Illuminate Encryption package.

9229.7M280](/packages/illuminate-encryption)

PHPackages © 2026

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