PHPackages                             jtd420/laravel-pgp - 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. jtd420/laravel-pgp

AbandonedArchivedLibrary[Security](/categories/security)

jtd420/laravel-pgp
==================

Automatic PGP Encryption/Decryption for your laravel application. Fully customisable and works out-the-box with the default provided scaffolding!

5286↓50%1[2 PRs](https://github.com/JTD420/laravel-pgp/pulls)PHP

Since Feb 16Pushed 2y ago2 watchersCompare

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

READMEChangelogDependenciesVersions (7)Used By (0)

Automatic PGP Encryption/Decryption for your laravel application. Fully customisable and works out-the-box with the default provided scaffolding!
=================================================================================================================================================

[](#automatic-pgp-encryptiondecryption-for-your-laravel-application-fully-customisable-and-works-out-the-box-with-the-default-provided-scaffolding)

[![Latest Version on Packagist](https://camo.githubusercontent.com/2b7dee1a705bb69ae65ddcb1f39f705dabd65bfbe6b5a1222be616c0d5157960/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a74643432302f6c61726176656c2d7067702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jtd420/laravel-pgp)[![GitHub Tests Action Status](https://camo.githubusercontent.com/6b25fe81a71316664cf91c11a87ca2f01d66de9590cc69b1f85cb38b12732b6b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6a74643432302f6c61726176656c2d7067702f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/jtd420/laravel-pgp/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/f5aa20a47ef47411f1e519ab3d43233516989f2921c95a2b6159eac0abf1c6f9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6a74643432302f6c61726176656c2d7067702f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/jtd420/laravel-pgp/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/165e03f56c89bb16f7ce540acf50e7291d050736108928da73424f763798b39d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a74643432302f6c61726176656c2d7067702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jtd420/laravel-pgp)

Important Notice
----------------

[](#important-notice)

Please be advised that Laravel-PGP is currently in its early stages of development (version 0.0.1) and may not be suitable for production use in critical environments.

This package provides a convenient way for Laravel users to add PGP encryption and decryption functionality to their projects, with the added bonus of default scaffolding for a chat interface.

However, as with any new software, it is still undergoing testing and refinement. We recommend that users exercise caution and carefully evaluate its suitability for their specific use case before implementing it in a live environment.

Support us
----------

[](#support-us)

Future updates will include ways to support this project and others.

[![](https://camo.githubusercontent.com/927f3bfb4be3517629539941559fa0e58eba47a821cd94a7e870b49135d67f64/68747470733a2f2f75706c6f61642e77696b696d656469612e6f72672f77696b6970656469612f636f6d6d6f6e732f7468756d622f392f39612f4c61726176656c2e7376672f3132303070782d4c61726176656c2e7376672e706e67)](https://github.com/JTD420/laravel-pgp)

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

[](#installation)

You can require the package via composer:

```
composer require jtd420/laravel-pgp
```

### Installing the package

[](#installing-the-package)

To install the package into your Laravel application, you need to require it using composer and run the following Artisan command:

```
php artisan PGP::install blade
```

If you prefer a dark theme, the following command can be run instead with the `--dark` option:

```
php artisan PGP::install blade --dark
```

You can publish and run the migrations with:

```
php artisan vendor:publish --tag="PGP-migrations"
php artisan migrate
```

You can publish the config file with:

```
php artisan vendor:publish --tag="PGP-config"
```

This is the contents of the published config file:

```
return [
    /*
     * To prevent naming conflicts, this prefix will be added to all Laravel-PGP migrations.
     */
    'table_prefix' => 'pgp_',

    /*
     * Prefix added to rest of Laravel-PGP code, including routes. (Delete default to remove prefix)
     */
    'prefix' => 'PGP',

    /*
     * Choose the layout file to be extended by the views provided in the package.
     * The default layout file is set to 'PGP::layouts.app', but can be changed to match your preferred layout.
     */
    'layout_file' => 'PGP::layouts.app',
    /*
     * Choose the section name to be used in the views provided in the package.
     * The default section name is set to 'content', but it can be changed to match the section defined in your custom layout file.
     * This option is only applicable if you have set a custom 'layout_file' with a different '@section()' name.
     */

    'layout_section' => 'content',

    'uses_custom_auth' => true,

];
```

Optionally, you can publish the views using

```
php artisan vendor:publish --tag="PGP-views"
```

Usage
-----

[](#usage)

This package includes the PGPController class located at `App/Http/Controllers/PGPController` for users who want to understand the inner workings of the package and possibly modify it. However, if all you want is the default encrypted messaging functionality, there's no need for any additional setup. The package provides sensible defaults for easy use, as well as being highly customizable for those who want to extend it.

To use the class and its methods, it must be imported into a controller and instantiated:

```
use App\Http\Controllers\PGPController;
$controller = new PGPController();
```

### Generating a Keypair

[](#generating-a-keypair)

The `generate_keypair` method generates a public/private keypair and returns both the public and private key as enarmoured PGP keys.

```
$keypair = $controller->generate_keypair('Name', 'email@email.com', 'RealSecurePassPhrase');
$public_key = $keypair['public_key'];
$private_key = $keypair['private_key'];
```

### Encrypting a Message

[](#encrypting-a-message)

The `encrypt` method takes a public key and a message and returns an encrypted enarmoured PGP message.

```
$encrypted_message = $controller->encrypt($public_key, 'secret message');
```

### Decrypting a Message

[](#decrypting-a-message)

The `decrypt` method takes a private key, encrypted message and passphrase and returns either the decrypted message or a json error if decryption fails.

```
$decrypted_message = $controller->decrypt($private_key, $encrypted_message, 'RealSecurePassPhrase');
```

For more, see the wiki [here!](https://github.com/JTD420/laravel-pgp/wiki#usage)

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Brad](https://github.com/JTD420)
- [All Contributors](../../contributors)
- [SingPolyma/OpenPGP-PHP](https://github.com/singpolyma/openpgp-php/)

License
-------

[](#license)

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

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity29

Early-stage or recently created project

 Bus Factor1

Top contributor holds 98.3% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/455da4816de869f2372def53b4c76326b40f23552d110520f8b9036b43faa072?d=identicon)[JTD420](/maintainers/JTD420)

---

Top Contributors

[![JTD420](https://avatars.githubusercontent.com/u/9684750?v=4)](https://github.com/JTD420 "JTD420 (58 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

### Embed Badge

![Health badge](/badges/jtd420-laravel-pgp/health.svg)

```
[![Health](https://phpackages.com/badges/jtd420-laravel-pgp/health.svg)](https://phpackages.com/packages/jtd420-laravel-pgp)
```

###  Alternatives

[defuse/php-encryption

Secure PHP Encryption Library

3.9k162.4M214](/packages/defuse-php-encryption)[roave/security-advisories

Prevents installation of composer packages with known security vulnerabilities: no API, simply require it

2.9k97.3M6.4k](/packages/roave-security-advisories)[mews/purifier

Laravel 5/6/7/8/9/10 HtmlPurifier Package

2.0k16.7M113](/packages/mews-purifier)[robrichards/xmlseclibs

A PHP library for XML Security

41278.1M118](/packages/robrichards-xmlseclibs)[bjeavons/zxcvbn-php

Realistic password strength estimation PHP library based on Zxcvbn JS

86917.5M63](/packages/bjeavons-zxcvbn-php)[enlightn/security-checker

A PHP dependency vulnerabilities scanner based on the Security Advisories Database.

33732.2M110](/packages/enlightn-security-checker)

PHPackages © 2026

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