PHPackages                             lazervel/cryptor - 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. lazervel/cryptor

ActiveLibrary[Security](/categories/security)

lazervel/cryptor
================

Cryptor is a PHP library for easy and secure data encryption and decryption.

v1.0.0(6mo ago)29941MITPHPPHP ^7.2 || ^8.0CI passing

Since Oct 24Pushed 6mo ago7 watchersCompare

[ Source](https://github.com/lazervel/cryptor)[ Packagist](https://packagist.org/packages/lazervel/cryptor)[ Docs](https://github.com/lazervel)[ Fund](https://github.com/sponsors/indianmodassir)[ RSS](/packages/lazervel-cryptor/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (1)

Cryptor
=======

[](#cryptor)

A lightweight and secure PHP encryption library that provides modern **AES-256-GCM** authenticated encryption and decryption with optional AAD (Additional Authenticated Data) support.
It is designed to be **simple, dependency-free**, and compatible with any PHP application or framework.

---

Features
--------

[](#features)

- ✅ AES-256-GCM authenticated encryption
- ✅ Optional AAD (Additional Authenticated Data)
- ✅ Secure key handling &amp; memory cleanup
- ✅ JSON + Base64 encoded output
- ✅ Key derived safely from `APP_KEY` or custom string
- ✅ No framework dependency (works in plain PHP or Laravel)

---

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

[](#installation)

Use Composer (recommended):

```
composer require lazervel/cryptor
```

Or manually include it:

```
require_once 'src/Cryptor.php';
```

---

⚙️ Environment Setup
--------------------

[](#️-environment-setup)

Set your application key in `.env` or environment variables:

```
APP_KEY=base64:your-secret-key
```

Alternatively, you can provide a custom key directly when creating an instance.

---

🧠 Basic Usage
-------------

[](#-basic-usage)

```
