PHPackages                             asmari/laravel-secure-docs - 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. asmari/laravel-secure-docs

ActiveLibrary[Security](/categories/security)

asmari/laravel-secure-docs
==========================

A Laravel package to securely encrypt and store ID documents (KTP, SIM, etc).

v1.0.6(4mo ago)013MITPHPPHP ^8.1

Since Dec 14Pushed 4mo agoCompare

[ Source](https://github.com/asmari/laravel-secure-docs)[ Packagist](https://packagist.org/packages/asmari/laravel-secure-docs)[ RSS](/packages/asmari-laravel-secure-docs/feed)WikiDiscussions main Synced 1mo ago

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

Laravel Secure Docs
===================

[](#laravel-secure-docs)

**Laravel Secure Docs** is a robust package for securely encrypting and storing sensitive user documents (ID Cards, Passports, Contracts) in Laravel applications.

It uses **AES-256-CBC** encryption to ensure that files are encrypted *before* they touch the disk. Even if your storage volume is compromised, the files remain unreadable without your application's `APP_KEY`.

Features
--------

[](#features)

- **Zero-Knowledge Storage:** Files are stored as encrypted blobs (`.dat`).
- **Filename Hashing:** Original filenames are hidden; storage paths are randomized.
- **On-the-Fly Decryption:** Files are decrypted in memory only when requested.
- **Polymorphic:** Attach secure documents to *any* model (`User`, `Employee`, `Company`, etc.).
- **Laravel 10, 11, &amp; 12 Ready.**

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

[](#requirements)

- PHP ^8.1
- Laravel ^10.0, ^11.0, or ^12.0

---

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

[](#installation)

Run:

```
composer require asmari/laravel-secure-docs:dev-main
```

Setup
-----

[](#setup)

1. Run Migrations Publish the package migration to create the secure\_documents table:

```
php artisan migrate
```

2. Add the Trait Add the HasSecureDocs trait to any model that needs to upload documents (e.g., User, Employee).

```
namespace App\Models;

use Illuminate\Foundation\Auth\User as Authenticatable;
use Asmari\SecureDocs\Traits\HasSecureDocs; //  'required|file|mimes:jpg,png,pdf|max:2048'
    ]);

    // Automatically encrypts, hashes, and saves metadata
    $user = auth()->user();
    $user->uploadSecureDoc($request->file('id_card'));

    return back()->with('success', 'Document encrypted successfully!');
}
```

2. Decrypting &amp; Viewing To view a file, use the model to fetch the metadata and stream the decrypted content.

Controller Example:

```
use Asmari\SecureDocs\Models\SecureDocument;

public function show($id)
{
    $doc = SecureDocument::findOrFail($id);

    // Authorization: Ensure user owns this file (or use a Policy)
    if ($doc->model_id !== auth()->id()) {
        abort(403);
    }

    // 'decrypted_content' is a helper attribute that decrypts on the fly
    return response($doc->decrypted_content)
        ->header('Content-Type', $doc->mime_type)
        ->header('Content-Disposition', 'inline; filename="' . $doc->original_name . '"');
}
```

Blade View Example:

```

    View Encrypted File

```

⚠️ Critical Security Notice

This package relies on your Laravel application's APP\_KEY (found in .env).

1. Do NOT lose your APP\_KEY. If you change or lose this key, all encrypted files will become permanently unreadable (garbage data).
2. Backup your APP\_KEY securely.
3. Ensure your storage/app/private\_docs folder is not symlinked to public/. It must remain private.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance75

Regular maintenance activity

Popularity5

Limited adoption so far

Community6

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

Every ~4 days

Total

6

Last Release

133d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/77bed2e360233678b42e46fadf459551455f203f42a7934315451d52aecb701a?d=identicon)[asmari](/maintainers/asmari)

---

Top Contributors

[![asmari](https://avatars.githubusercontent.com/u/10450801?v=4)](https://github.com/asmari "asmari (2 commits)")

### Embed Badge

![Health badge](/badges/asmari-laravel-secure-docs/health.svg)

```
[![Health](https://phpackages.com/badges/asmari-laravel-secure-docs/health.svg)](https://phpackages.com/packages/asmari-laravel-secure-docs)
```

###  Alternatives

[illuminate/encryption

The Illuminate Encryption package.

9229.7M280](/packages/illuminate-encryption)[tzsk/otp

A secure, database-free One-Time Password (OTP) generator and verifier for PHP and Laravel.

241641.4k1](/packages/tzsk-otp)[genealabs/laravel-governor

Managing policy and control in Laravel.

201262.8k](/packages/genealabs-laravel-governor)[dgtlss/warden

A Laravel package that proactively monitors your dependencies for security vulnerabilities by running automated composer audits and sending notifications via webhooks and email

8745.6k](/packages/dgtlss-warden)[ercsctt/laravel-file-encryption

Secure file encryption and decryption for Laravel applications

642.6k](/packages/ercsctt-laravel-file-encryption)[laragear/poke

Keep your forms alive, avoid TokenMismatchException by gently poking your Laravel app

2211.5k](/packages/laragear-poke)

PHPackages © 2026

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