PHPackages                             mrdebug/lara-file-encrypter - 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. mrdebug/lara-file-encrypter

ActiveLibrary[Security](/categories/security)

mrdebug/lara-file-encrypter
===========================

LaraFileEncrypter: A Laravel package enabling secure and seamless management of encrypted files without the need for persistent key storage.

1.0(2y ago)416857MITPHPPHP &gt;=8.0.0

Since Dec 7Pushed 2y ago1 watchersCompare

[ Source](https://github.com/misterdebug/laravel-file-encrypter)[ Packagist](https://packagist.org/packages/mrdebug/lara-file-encrypter)[ RSS](/packages/mrdebug-lara-file-encrypter/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (2)Used By (0)

LaraFileEncrypter: Secure your files in Laravel with AES-256 encryption, without persistent key storage hassle.
===============================================================================================================

[](#larafileencrypter-secure-your-files-in-laravel-with-aes-256-encryption-without-persistent-key-storage-hassle)

[![image](https://private-user-images.githubusercontent.com/23297600/288640147-4beeebb4-d064-4d09-9c81-876d5dbdde69.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODMwMzM2ODIsIm5iZiI6MTc4MzAzMzM4MiwicGF0aCI6Ii8yMzI5NzYwMC8yODg2NDAxNDctNGJlZWViYjQtZDA2NC00ZDA5LTljODEtODc2ZDVkYmRkZTY5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA3MDIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdW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PFv1nnYiKgUkq_vE6o)

LaraFileEncrypter is a Laravel package, designed to enhance file security in your applications. With a straightforward integration, it enables you to easily implement AES-256 encryption. What sets LaraFileEncrypter apart is its unique approach: delivering maximum security without the need for key storage. Now, securing your files becomes a straightforward process, ensuring data confidentiality without added complexity.

How does it work?
-----------------

[](#how-does-it-work)

LaraFileEncrypter simplifies file security by eliminating the need to manage encryption keys. Instead, the process relies on the use of a user-chosen password.

When encrypting a file, LaraFileEncrypter generates an encryption key based on the provided password. It's this key, derived from the password, that is used to secure your files using the AES-256 algorithm.

This approach removes the necessity of storing or managing separate encryption keys. By choosing a robust password, you ensure effective protection of your files without the complexity associated with traditional key management.

Pros and cons
-------------

[](#pros-and-cons)

ProsConsNo key storageLoss of password leads to unrecoverable fileEach user can encrypt their files with a unique passwordAES keys potentially less robust than truly random methodsNo modifications needed on the files infrastructure or database sidePotentially predictable keysConvinced ? 🙂

If you find this project useful, please consider giving it a star⭐. It helps me prioritize and focus on keeping project up-to-date. Thank you for your support!

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

[](#installation)

`composer require mrdebug/lara-file-encrypter`

Usage
-----

[](#usage)

This package provides a facade called `LaraFileEncrypter`.

### Encrypt a file

[](#encrypt-a-file)

The `encryptFile` method `public function encryptFile(string $filePath, string $rawPassword)` locates a file and replaces its existing content with his encrypted content using the provided password. The password must be provided in raw text.

Example :

```
LaraFileEncrypter::encryptFile(
  storage_path('app/files/secret-file.pdf'),
  'mysecurerawpassword'
);
```

You can add a salt :

```
LaraFileEncrypter::encryptFile(
  storage_path('app/files/secret-file.pdf'),
  'mysecurerawpassword'.$salt
);
```

### Decrypt a file

[](#decrypt-a-file)

The `LaraFileEncrypter` facade provides two methods for decrypting a file. One method streamDownload (`decryptAndStreamDownloadFile()`) the file, while the other decrypts the file's content (`decryptContentFile()`).

```
public function decryptAndStreamDownloadFile(string $filePath, string $rawPassword)
```

and

```
public function decryptContentFile(string $filePath, string $rawPassword)
```

Examples :

```
LaraFileEncrypter::decryptAndStreamDownloadFile(
  storage_path('app/files/secret-file.pdf'),
  'mysecurerawpassword'
);
```

and

```
LaraFileEncrypter::decryptContentFile(
  storage_path('app/files/secret-file.pdf'),
  'mysecurerawpassword'
);
```

You must, of course, provide the same password as used in the encryption step.

License
-------

[](#license)

This package is licensed under the [license MIT](http://opensource.org/licenses/MIT).

Other Projects
--------------

[](#other-projects)

Explore my other projects on GitHub:

- **[Crud Generator Laravel](https://github.com/misterdebug/crud-generator-laravel)**: Create a Laravel 10 CRUD in a few seconds

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

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

940d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/916d270fbf3b92b8313b2d17ce7229dc1112b0c7ab82064d6078b5cb6ec83496?d=identicon)[mrdebug](/maintainers/mrdebug)

---

Tags

composer-packagedecryptionencryptionencryption-decryptionfilelaravellaravel-file-encrypterlaravel-packagelaravel10password-based-encryptionlaravelsecurityencryptionencryptdecryptlaravel-packagecrud generatorcomposer-packagedecryptionlaravel10file-encryptionsecure file managementpassword-based encryptionfile protectionlaravel-file-encrypter

### Embed Badge

![Health badge](/badges/mrdebug-lara-file-encrypter/health.svg)

```
[![Health](https://phpackages.com/badges/mrdebug-lara-file-encrypter/health.svg)](https://phpackages.com/packages/mrdebug-lara-file-encrypter)
```

###  Alternatives

[nzo/url-encryptor-bundle

The NzoUrlEncryptorBundle is a Symfony Bundle used to Encrypt and Decrypt data and variables in the Web application or passed through URL

971.1M2](/packages/nzo-url-encryptor-bundle)[poly-crypto/poly-crypto

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

128.1k1](/packages/poly-crypto-poly-crypto)[al-saloul/encryption

Simple number encryption and decryption package

181.5k](/packages/al-saloul-encryption)

PHPackages © 2026

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