PHPackages                             inanepain/crypt - 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. inanepain/crypt

ActiveLibrary[Security](/categories/security)

inanepain/crypt
===============

Encryption helpers and password hashers.

0.1.0(3y ago)10UNLICENSEPHPPHP &gt;=8.1

Since Jul 26Pushed 2w ago1 watchersCompare

[ Source](https://github.com/inanepain/crypt)[ Packagist](https://packagist.org/packages/inanepain/crypt)[ Docs](http://vaieen.local:8000/inane/crypt)[ RSS](/packages/inanepain-crypt/feed)WikiDiscussions develop Synced 1w ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

inanepain/crypt [![icon](./icon.png "inanepain/crypt")](./icon.png)
===================================================================

[](#inanepaincrypt-)

Table of Contents

- [![icon](./icon.png "inanepain/crypt") inanepain/crypt](#inanepaincrypt)
- [1. Install](#install)
- [2. Crypt](#crypt)
- [3. Secret](#secret)
    - [3.1. Properties](#properties)
    - [3.2. Methods](#methods)

[![icon](./icon.png "inanepain/crypt")](./icon.png) inanepain/crypt
-------------------------------------------------------------------

[](#-inanepaincrypt)

Encryption helpers and password hashers.

1. Install
----------

[](#1-install)

composer

```
composer require inanepain/crypt
```

2. Crypt
--------

[](#2-crypt)

This is meant as more of an introduction to the classes found in the `Inane\Crypt` namespace and not an in-depth guide.

Classes

- [Secret](#secret)

3. Secret
---------

[](#3-secret)

The `Secret` **class** is a helper for encrypting and decrypting strings using OpenSSL. It also provides methods to encode the encrypted data into a URL-safe format.

### 3.1. Properties

[](#31-properties)

properties

- protected string $passphrase
- protected string $cipher
- protected ?string $iv

### 3.2. Methods

[](#32-methods)

methods

- public function \_\_construct(string $passphrase, string $cipher = 'aes-256-ctr', ?string $iv = null)
- public function encrypt(string $plainText): string
- public function decrypt(string $encryptedText): string
- public function encode(string $encryptedText): string
- public function decode(string $encodedText): string
- public function encryptEncode(string $plainText): string
- public function decryptDecode(string $encryptedEncodedText): string

#### 3.2.1. Usage

[](#321-usage)

To use the `Secret` class, you need to instantiate it with a passphrase (minimum 16 characters).

Encryption and Decryption

```
use Inane\Crypt\Secret;

$passphrase = 'a-very-secret-phrase-of-at-least-16-chars';
$secret = new Secret($passphrase);

$originalText = 'Hello World!';

// Encrypt
$encrypted = $secret->encrypt($originalText);

// Decrypt
$decrypted = $secret->decrypt($encrypted);

echo $decrypted; // Hello World!
```

#### 3.2.2. URL Safe Encoding

[](#322-url-safe-encoding)

Encrypted data often contains characters that are not safe for URLs (like `+`, `/`, `=`). The `encode` and `decode` methods handle this by replacing them with URL-safe alternatives.

URL Safe Encryption

```
$secret = new Secret($passphrase);

$originalText = 'Sensitive Data';

// Encrypt and Encode in one go
$urlSafeEncrypted = $secret->encryptEncode($originalText);

// ... later ...

// Decode and Decrypt
$decrypted = $secret->decryptDecode($urlSafeEncrypted);

echo $decrypted; // Sensitive Data
```

#### 3.2.3. Custom Cipher and IV

[](#323-custom-cipher-and-iv)

By default, it uses `aes-256-ctr`. You can specify a different cipher or provide your own IV.

Custom Cipher

```
$secret = new Secret($passphrase, 'aes-128-cbc', 'my-custom-iv-123');
```

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance63

Regular maintenance activity

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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

1459d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1823594?v=4)[Philip Michael Raab](/maintainers/inanepain)[@inanepain](https://github.com/inanepain)

---

Top Contributors

[![inanepain](https://avatars.githubusercontent.com/u/1823594?v=4)](https://github.com/inanepain "inanepain (24 commits)")

---

Tags

composercryptdecryptencryptlibraryphpphpencryptdecryptcryptinane

### Embed Badge

![Health badge](/badges/inanepain-crypt/health.svg)

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

###  Alternatives

[xxtea/xxtea

XXTEA is a fast and secure encryption algorithm. This is a XXTEA library for PHP.

11343.0k](/packages/xxtea-xxtea)[miladrahimi/phpcrypt

Encryption, decryption, and hashing tools for PHP projects

3075.7k2](/packages/miladrahimi-phpcrypt)[hemiframe/php-aes

PHP class for encrypt and decrypt data with AES algorithm

1031.4k](/packages/hemiframe-php-aes)[poly-crypto/poly-crypto

High-level cryptographic functions that are interoperable between NodeJS and PHP 7.1+

128.1k1](/packages/poly-crypto-poly-crypto)

PHPackages © 2026

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