Skip to main content

Additional Functions

You have additional functions such as

  • Class b64 : for Base64 encoding and decoding.
  • newkey : for creating a new API key
  • verifykey : for comparing two keys
  • status : for setting status code

Class b64 Usage

$data = "hello world";
$encoded = Api::b64()->Encrypt($data);
$decoded = Api::b64()->Decrypt($encoded);

New Key Usage

$newkey = Api::newkey(20);

Default length is 39 characters

Verify Key Usage

$key1 = "hello world";
$key2 = "hello world";
$verification = Api::verifykey($key1, $key2); // returns true if the keys match

Status Usage

Api::status(200);

It sets the status to the given number