Here's a quick example on how to use sodium_crypto_sign(); where you have a message that you want to sign, so anyone with the public key can confirm that the message hasn't been tampered with.
This is similar to sodium_crypto_sign_detached(), but the returned string contains the original message as well (in plain text, at the end, so anyone can read it).
<?php
$sign_pair = sodium_crypto_sign_keypair();
$sign_secret = sodium_crypto_sign_secretkey($sign_pair);
$sign_public = sodium_crypto_sign_publickey($sign_pair);
$message = 'Hello';
$message_signed = sodium_crypto_sign($message, $sign_secret);
$message = sodium_crypto_sign_open($message_signed, $sign_public);
echo $message . "\n";
?>