Encrypt
extends Encrypt
in package
The Encrypt library provides two-way encryption of text and binary strings using the openSSL extension.
Use Kb\Encrypt or Sprout::getEncrypt instead.
Table of Contents
Properties
- $config : array<string|int, mixed>
Methods
- __construct() : mixed
- Loads encryption configuration and validates the data.
- decode() : string
- Decrypts an encoded string back to its original value.
- decodeMultipleFields() : void
- Decode multiple fields in a data array, modifying the array in place.
- encode() : string
- Encrypts a string and returns an encrypted string that can be decoded.
- encodeMultipleFields() : void
- Encode multiple fields in a data array, modifying the array in place.
- instance() : Encrypt
- Returns a singleton instance of Encrypt.
Properties
$config
protected
array<string|int, mixed>
$config
Methods
__construct()
Loads encryption configuration and validates the data.
public
__construct(array<string|int, mixed> $config) : mixed
Parameters
- $config : array<string|int, mixed>
-
Encrypt configuration including key, cipher and iv_size
Tags
decode()
Decrypts an encoded string back to its original value.
public
decode(string $data) : string
Parameters
- $data : string
-
encoded string to be decrypted
Return values
string —decrypted data
decodeMultipleFields()
Decode multiple fields in a data array, modifying the array in place.
public
decodeMultipleFields(array<string|int, mixed> &$data, array<string|int, mixed> $fields) : void
Parameters
- $data : array<string|int, mixed>
-
The complete data set we're working with
- $fields : array<string|int, mixed>
-
The keys of the fields to decode
encode()
Encrypts a string and returns an encrypted string that can be decoded.
public
encode(string $data) : string
Parameters
- $data : string
-
data to be encrypted
Return values
string —encrypted data
encodeMultipleFields()
Encode multiple fields in a data array, modifying the array in place.
public
encodeMultipleFields(array<string|int, mixed> &$data, array<string|int, mixed> $fields) : void
Parameters
- $data : array<string|int, mixed>
-
The complete data set we're working with
- $fields : array<string|int, mixed>
-
The keys of the fields to encode
instance()
Returns a singleton instance of Encrypt.
public
static instance([array<string|int, mixed> $config = [] ]) : Encrypt
Parameters
- $config : array<string|int, mixed> = []
-
configuration options