phpcq/gnupg
GnuPG wrapper and signature verification library used by the phpcq tool runner. Provides a lightweight API for interacting with GnuPG and validating signatures to support automated PHP code quality checks in CI pipelines.
phpcq/gnupg package is a GnuPG wrapper tailored for signature verification and encryption, primarily designed for CI/CD and code quality automation. For Laravel, its relevance depends on:
.env files, secrets).gpg) installed system-wide, introducing environmental constraints (e.g., Docker, CI, or shared hosting may lack it).phpseclib or native bindings..env, Vault, or KMS).| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Environmental Dependency | High | Document GnuPG installation requirements; provide Docker/CI templates with gpg preinstalled. |
| Performance Overhead | Medium | Benchmark against alternatives (e.g., phpseclib); implement caching for keys/signatures. |
| Security Misconfiguration | High | Enforce passphrase management (e.g., Laravel Vault, AWS Secrets Manager); audit key storage. |
| Lack of Laravel Patterns | Medium | Abstract behind a GpgService class with Service Provider/Facade; follow Laravel’s DI principles. |
| Limited Maintenance | High | Monitor for upstream updates; consider forking or extending if critical. |
| GnuPG Version Mismatches | Medium | Test with multiple GnuPG versions; document supported versions in README. |
Use Case Clarity:
libsodium, or phpseclib) that better fit the needs?Environmental Constraints:
Security Model:
.env, HashiCorp Vault, AWS KMS)Performance:
Maintenance and Longevity:
Laravel-Specific Needs:
SignatureFailed)?GpgService interface.Gpg::verify()).php artisan gpg:import-key).SignatureVerified, SignatureFailed).GpgService wrapping the package’s core methods.exec('gpg --verify')), replace them with the package.| Component | Compatibility Notes |
|---|---|
| Laravel Versions | Tested with Laravel 9+/10+ (PHP 8.0+). Check for BC breaks in newer Laravel releases. |
| GnuPG Versions | Requires GnuPG 2.x. Test with latest stable to avoid version mismatches. |
| PHP Extensions | None required, but openssl may be needed for key generation. |
| Operating Systems | Linux/macOS (GnuPG preinstalled). Windows requires manual setup (e.g., Gpg4win). |
| Key Formats | Supports ASCII-armored and binary keys. Ensure compatibility with your workflow. |
gpg --gen-key).GpgService with basic operations (verify, encrypt, decrypt).GpgException for failed operations).AppServiceProvider:
$this->app->singleton(GpgService::class, function ($app) {
$gnupg = new \Phpcq\Gnupg\Gnupg();
$gnupg->setBinary(config('gnupg.binary_path'));
return new GpgService($gnupg);
});
Facade::register(GpgService::class, 'Gpg');
GpgService (mock GnuPG calls).How can I help you explore Laravel packages today?