Skip to content

Latest commit

 

History

History
35 lines (25 loc) · 794 Bytes

File metadata and controls

35 lines (25 loc) · 794 Bytes

marko/encryption

Interfaces for encryption--defines how data is encrypted and decrypted, not which cipher is used.

Installation

composer require marko/encryption

Note: You typically install a driver package (like marko/encryption-openssl) which requires this automatically.

Quick Example

use Marko\Encryption\Contracts\EncryptorInterface;

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

    public function issueToken(array $payload): string
    {
        return $this->encryptor->encrypt(
            json_encode($payload, JSON_THROW_ON_ERROR),
        );
    }
}

Documentation

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