Skip to content

Latest commit

 

History

History
38 lines (27 loc) · 880 Bytes

File metadata and controls

38 lines (27 loc) · 880 Bytes

marko/encryption-openssl

OpenSSL encryption driver --- encrypts and decrypts data using AES-256-GCM with authenticated encryption.

Installation

composer require marko/encryption-openssl

Requires the ext-openssl PHP extension. Automatically installs marko/encryption.

Quick Example

use Marko\Encryption\Contracts\EncryptorInterface;

class SecureStorage
{
    public function __construct(
        private EncryptorInterface $encryptor,
    ) {}

    public function store(string $sensitiveData): string
    {
        return $this->encryptor->encrypt($sensitiveData);
    }

    public function retrieve(string $encrypted): string
    {
        return $this->encryptor->decrypt($encrypted);
    }
}

Documentation

Full usage, API reference, and examples: marko/encryption-openssl