PHPackages                             desaikalpesh34/yii2-cryptography - 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. desaikalpesh34/yii2-cryptography

ActiveYii2-extension[Security](/categories/security)

desaikalpesh34/yii2-cryptography
================================

yii2-cryptography automate encryption decryption

026PHP

Since Aug 3Pushed 6y ago1 watchersCompare

[ Source](https://github.com/desaikalpesh34/yii2-cryptography)[ Packagist](https://packagist.org/packages/desaikalpesh34/yii2-cryptography)[ RSS](/packages/desaikalpesh34-yii2-cryptography/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

yii2-cryptography
=================

[](#yii2-cryptography)

yii2-cryptography automate encryption/decription

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist desaikalpesh34/yii2-cryptography "dev-master"

```

or add

```
"desaikalpesh34/yii2-cryptography": "dev-master"

```

to the require section of your `composer.json` file.

Usage
-----

[](#usage)

Once the extension is installed, simply use it in your code by :

Add the following lines in the `components` section of your config file.

```
'crypto'=> [
		    'class'=>'\cryptography\components\Crypto',
		    'secrateKey'=>'SecrateKeyGoesHere',
	    ],

```

Basic Usage
-----------

[](#basic-usage)

You can now use the component manually in any part of the application to either encrypt data

```
\Yii::$app->crypto->encrypt('data to encrypt');

```

or decrypt and encrypted data

```
\Yii::$app->crypto->decrypt('data to decrypt');

```

Behavior
--------

[](#behavior)

The extension also comes with a behavior that you can easily attach to any ActiveRecord Model.

Use the following syntax to attach the behavior.

```
public function behaviors()
{
    return [
        'encryption' => [
            'class' => '\cryptography\behaviors\CryptographicBehavior',
            'attributes' => [
                'column1',
                'column2',
				'column3',
				   .
				   .
				   .
            ],
        ],
    ];
}

```

The behavior will automatically encrypt all the data before saving it on the database and decrypt it after the retrieve.

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/3320825a3c1842bb3bc94b1185ac5b36827fc4bb8332779f92d35a76723048ac?d=identicon)[desaikalpesh34](/maintainers/desaikalpesh34)

---

Top Contributors

[![desaikap](https://avatars.githubusercontent.com/u/6148615?v=4)](https://github.com/desaikap "desaikap (3 commits)")

### Embed Badge

![Health badge](/badges/desaikalpesh34-yii2-cryptography/health.svg)

```
[![Health](https://phpackages.com/badges/desaikalpesh34-yii2-cryptography/health.svg)](https://phpackages.com/packages/desaikalpesh34-yii2-cryptography)
```

###  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)[enlightn/security-checker

A PHP dependency vulnerabilities scanner based on the Security Advisories Database.

33732.2M110](/packages/enlightn-security-checker)

PHPackages © 2026

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