jtd420/laravel-pgp
Composer 安装命令:
composer require jtd420/laravel-pgp
包简介
Automatic PGP Encryption/Decryption for your laravel application. Fully customisable and works out-the-box with the default provided scaffolding!
关键字:
README 文档
README
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
Future updates will include ways to support this project and others.
Installation
You can require the package via composer:
composer require jtd420/laravel-pgp
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
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
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
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
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!
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.
jtd420/laravel-pgp 适用场景与选型建议
jtd420/laravel-pgp 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 313 次下载、GitHub Stars 达 4, 最近一次更新时间为 2023 年 02 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「JTD420」 「laravel-pgp」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 jtd420/laravel-pgp 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jtd420/laravel-pgp 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 jtd420/laravel-pgp 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Alfabank REST API integration
A high-performance OpenPGP cryptography library for PHP and Laravel supporting RSA, ElGamal, Ed25519 (EdDSA), ECDSA, and ECDH. Modern, secure, and zero-dependency alternative to php-gnupg.
Laravel package for Accurate Online API integration.
Shared RCX Laravel DataTables UI and configuration helpers.
Boot a Laravel project on any machine with one command: app:serve installs missing tools (PHP, Node, Composer, Herd, Docker), creates .env, sets up the database, runs migrations, builds assets, starts a queue worker and serves via Herd, Sail or artisan serve; app:down cleanly stops everything it sta
Branded, diagnostic error pages (500, 403, 404, 419, 503) for Filament — native Filament UI, dark mode and translations out of the box.
统计信息
- 总下载量: 313
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-02-09