- Can I use this package for secure data encryption in Laravel?
- No, this package implements RC4, a deprecated and cryptographically broken cipher. Use Laravel’s built-in `Crypt` facade (AES-256) or Libsodium for security-sensitive applications. RC4 should only be used for legacy compatibility or non-sensitive obfuscation.
- How do I install `wdalmut/rc4-support` in a Laravel project?
- Run `composer require wdalmut/rc4-support` in your project root. The package has no additional dependencies and works with Laravel 8+ (PHP 7.4+). Register it in your `AppServiceProvider` if using dependency injection.
- What Laravel versions does this package support?
- This package supports Laravel 8+ (PHP 7.4+). It’s stateless and integrates seamlessly with Laravel’s service container, but avoid mixing it with Laravel’s `Crypt` facade for security reasons.
- How do I encrypt/decrypt strings with RC4 in Laravel?
- Instantiate the `RC4` class with a secret key, then use the `__invoke()` magic method or `rc4()` method. Example: `$rc4 = new RC4(config('app.rc4_key')); $encrypted = $rc4('plaintext');`
- Is this package suitable for high-throughput API responses?
- RC4 is fast, but it’s not recommended for production security. If performance is critical, consider alternatives like AES (via Laravel’s `Crypt` facade) or Libsodium. Test thoroughly in your environment before deployment.
- How should I handle encryption keys securely?
- Store keys in Laravel’s `.env` file (encrypted) or a secrets manager like AWS KMS or HashiCorp Vault. Never hardcode keys in source files. If security is a concern, avoid RC4 entirely and use Laravel’s `Crypt` facade instead.
- Are there alternatives to RC4 for Laravel?
- Yes. For security, use Laravel’s `Crypt` facade (AES-256) or Libsodium. For non-security obfuscation, consider `hash_hmac` or simple base64 encoding. Avoid mixing RC4 with modern encryption methods.
- Does this package work with Laravel’s Eloquent or database layers?
- Yes, but RC4 is stateless and won’t interfere with Eloquent. However, avoid storing RC4-encrypted data in logs, debug outputs, or unencrypted backups. Use it only for specific, isolated use cases.
- Is this package actively maintained?
- The package is lightweight and single-file, but it has no active maintenance. RC4 is deprecated, so consider it a legacy solution. Plan to migrate to Laravel’s `Crypt` facade or Libsodium in the future.
- How do I test RC4 encryption in Laravel?
- Run the included PHPUnit tests with `./vendor/bin/phpunit tests`. For Laravel integration, write unit tests for your service layer and mock the `RC4` class. Avoid testing RC4 directly in production environments.