richardstyles/eloquentencryption
phpseclib), aligning with modern cryptographic best practices for key rotation and data protection.config['app.key']) but extends it to per-attribute granularity.php artisan key:generate (see failure modes).WHERE encrypted_column = 'value' fails). Mitigation: Use partial encryption (e.g., encrypt only PII, not searchable fields).| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Key Compromise | Critical | Use AWS KMS/GCP KMS or Hashicorp Vault alongside Laravel’s app key for master key protection. |
| Downtime on Key Rotate | High | Implement dual-key rotation (temporary support for old/new keys during transition). |
| Query Limitations | Medium | Design schema to avoid querying encrypted fields (e.g., use computed columns for searchable data). |
| PHP 8.2+ Dependency | High | Upgrade path required for existing Laravel 11/10 apps. |
| phpseclib Vulnerabilities | Medium | Monitor phpseclib’s security advisories and update phpseclib proactively. |
APP_KEY) be stored and rotated in production? (e.g., AWS Secrets Manager vs. local .env).phpseclib compatibility.phpseclib/phpseclib: v3.x (bundled via Composer).credit_card_number, ssn).composer require richardstyles/eloquentencryption
php artisan vendor:publish --provider="RichardStyles\EloquentEncryption\EncryptionServiceProvider"
use RichardStyles\EloquentEncryption\Encryptable;
class User extends Model {
use Encryptable;
protected $encryptable = ['ssn', 'credit_card'];
}
APP_KEY in .env and restart workers.APP_KEY (risk if keys are leaked per tenant).config/eloquent-encryption.php) for key paths and algorithms.APP_KEY is backed up with database backups (used to decrypt data).APP_KEY in .env matches the key used during encryption.Xdebug or Blackfire.WHERE clauses.ELOQUENT_ENCRYPTION_LOGGING in config to log encryption events.dd($model->getEncryptedAttributes()) to inspect encrypted data..env).APP_KEY (use config management tools like Ansible/Chef).APP_KEY must be identical across regions (use a secrets manager).|
How can I help you explore Laravel packages today?