PHPackages                             burakdalyanda/cipher-weave - 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. burakdalyanda/cipher-weave

ActiveLibrary[Security](/categories/security)

burakdalyanda/cipher-weave
==========================

A seamless security layer for Laravel applications that automatically decrypts incoming requests and encrypts outgoing responses to ensure data integrity and confidentiality.

v2.0.1(4mo ago)311MITPHPPHP ^8.2CI passing

Since Aug 25Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/burakdalyanda/cipher-weave)[ Packagist](https://packagist.org/packages/burakdalyanda/cipher-weave)[ Docs](https://github.com/burakdalyanda/cipher-weave)[ RSS](/packages/burakdalyanda-cipher-weave/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (5)Versions (8)Used By (0)

CipherWeave
===========

[](#cipherweave)

CipherWeave is a Laravel middleware package designed to encrypt outgoing responses and decrypt incoming requests, ensuring your data remains secure throughout its journey.

Features
--------

[](#features)

- **Seamless Integration**: Easily integrate CipherWeave into your Laravel project.
- **Modern PHP &amp; Laravel**: Built for PHP 8.2+ and Laravel 10, 11, and 12.
- **Encryption &amp; Decryption**: Automatically encrypt responses and decrypt requests.
- **Configurable Security**: Customize encryption settings to fit your security needs.
- **Artisan Command**: Easily generate and set your encryption key.
- **Facade Support**: Simple access to encryption methods via `CipherWeave` Facade.

Requirements
------------

[](#requirements)

- PHP 8.2 or higher
- Laravel 10.x, 11.x or 12.x

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

[](#installation)

To install CipherWeave, use Composer:

```
composer require burakdalyanda/cipher-weave
```

Configuration
-------------

[](#configuration)

Publish the configuration file to customize encryption settings:

```
php artisan vendor:publish --tag=cipherweave-config
```

This will create a `config/cipher.php` file.

### Generate Encryption Key

[](#generate-encryption-key)

You must generate an encryption key for the package to work:

```
php artisan cipherweave:key
```

This command will generate a key and set it in your `.env` file as `CIPHER_KEY`.

Usage
-----

[](#usage)

### Register Middleware

[](#register-middleware)

#### Laravel 11 &amp; 12

[](#laravel-11--12)

Add the middleware in `bootstrap/app.php`:

```
->withMiddleware(function (Middleware $middleware) {
    $middleware->alias([
        'encrypt.request.response' => \BurakDalyanda\CipherWeave\Middleware\EncryptRequestResponse::class,
    ]);
})
```

#### Laravel 10

[](#laravel-10)

Add the middleware to your `app/Http/Kernel.php` file:

```
protected $routeMiddleware = [
    // Other middleware
    'encrypt.request.response' => \BurakDalyanda\CipherWeave\Middleware\EncryptRequestResponse::class,
];
```

### Protect Routes

[](#protect-routes)

Apply the middleware to your routes in `routes/web.php` or `routes/api.php`:

```
Route::middleware(['encrypt.request.response'])->group(function () {
    Route::get('/secure-endpoint', [SecureController::class, 'index']);
});
```

#### Using a Custom Encryption Key for Specific Routes

[](#using-a-custom-encryption-key-for-specific-routes)

You can override the default encryption key for specific routes:

```
Route::middleware(['encrypt.request.response:your-custom-base64-key'])->group(function () {
    Route::get('/secure-endpoint', [SecureController::class, 'index']);
});
```

### Facade Usage

[](#facade-usage)

You can use the `CipherWeave` facade for manual encryption and decryption:

```
use BurakDalyanda\CipherWeave\Facades\CipherWeave;

$encrypted = CipherWeave::encrypt('secret message');
$decrypted = CipherWeave::decrypt($encrypted);
```

### Manual Usage (DI)

[](#manual-usage-di)

You can also inject `CipherWeaveInterface`:

```
use BurakDalyanda\CipherWeave\Contracts\CipherWeaveInterface;

public function __construct(private CipherWeaveInterface $cipher) {}

public function someMethod() {
    $encrypted = $this->cipher->encrypt(['data' => 'to encrypt']);
}
```

Contributing
------------

[](#contributing)

Contributions are welcome! Please see the [CONTRIBUTING.md](CONTRIBUTING.md) file for more details.

License
-------

[](#license)

The MIT License (MIT). Please see the [License File](LICENSE) for more information.

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance74

Regular maintenance activity

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 57.9% 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 ~132 days

Total

5

Last Release

146d ago

Major Versions

v0.1.0-beta.1 → 1.02024-08-25

v1.0.x-dev → v2.0.02026-02-06

PHP version history (2 changes)v0.1.0-beta.1PHP ^8.0

v2.0.0PHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5329860?v=4)[Burak Dalyanda](/maintainers/burakdalyanda)[@burakdalyanda](https://github.com/burakdalyanda)

---

Top Contributors

[![burakdalyanda](https://avatars.githubusercontent.com/u/5329860?v=4)](https://github.com/burakdalyanda "burakdalyanda (11 commits)")[![burakdalyandaKc](https://avatars.githubusercontent.com/u/123945530?v=4)](https://github.com/burakdalyandaKc "burakdalyandaKc (8 commits)")

---

Tags

laravelencryptionlaravel-packagecipherdecryptionweavelaravel-encryptionlaravel-decryptionresponse-encryptionresponse-decryptionrequest-encryptionrequest-decryption

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/burakdalyanda-cipher-weave/health.svg)

```
[![Health](https://phpackages.com/badges/burakdalyanda-cipher-weave/health.svg)](https://phpackages.com/packages/burakdalyanda-cipher-weave)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k95.4M300](/packages/laravel-horizon)[laravel/sail

Docker files for running a basic Laravel application.

1.9k205.7M1.3k](/packages/laravel-sail)[illuminate/database

The Illuminate Database package.

2.8k54.9M11.5k](/packages/illuminate-database)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M188](/packages/laravel-ai)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M129](/packages/roots-acorn)

PHPackages © 2026

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