class Encrypter implements Encrypter (View source)

Methods

void
__construct(string $key, string $cipher = 'AES-128-CBC')

Create a new encrypter instance.

static bool
supported(string $key, string $cipher)

Determine if the given key and cipher combination is valid.

string
encrypt(string $value, bool $serialize = true)

Encrypt the given value.

string
encryptString(string $value)

Encrypt a string without serialization.

string
decrypt(string $payload, bool $unserialize = true)

Decrypt the given value.

string
decryptString(string $payload)

Decrypt the given string without unserialization.

string
getKey()

Get the encryption key.

Details

at line line 35
void __construct(string $key, string $cipher = 'AES-128-CBC')

Create a new encrypter instance.

Parameters

string $key
string $cipher

Return Value

void

Exceptions

RuntimeException

at line line 54
static bool supported(string $key, string $cipher)

Determine if the given key and cipher combination is valid.

Parameters

string $key
string $cipher

Return Value

bool

at line line 71
string encrypt(string $value, bool $serialize = true)

Encrypt the given value.

Parameters

string $value
bool $serialize

Return Value

string

Exceptions

EncryptException

at line line 107
string encryptString(string $value)

Encrypt a string without serialization.

Parameters

string $value

Return Value

string

at line line 121
string decrypt(string $payload, bool $unserialize = true)

Decrypt the given value.

Parameters

string $payload
bool $unserialize

Return Value

string

Exceptions

DecryptException

at line line 147
string decryptString(string $payload)

Decrypt the given string without unserialization.

Parameters

string $payload

Return Value

string

at line line 237
string getKey()

Get the encryption key.

Return Value

string