<?php
$message = 'The quick brown fox jumped over the lazy dog.';
# Generate keypair
$keyPair = sodium_crypto_sign_keypair();
# Sign a message
$secKey = sodium_crypto_sign_secretkey($keyPair);
$signature = sodium_crypto_sign_detached($message, $secKey);
# Verify a message
$pubKey = sodium_crypto_sign_publickey($keyPair);
$verifyResult = sodium_crypto_sign_verify_detached($signature, $message, $pubKey);
var_dump($verifyResult); # true or false
?>