I've found a way, in case if someone will need:
function generate_signature() {
$data = "Databeingpassed"
$secret_key = "Somesecretkey"
return base64_encode(hash_hmac('sha256', $data, $secret_key, true));
}
The output:
2XBK7UXA9oDsfJj1TBE2maptpB6i1MJ4uadY1AXlQOQ=