1. Go to this page and download the library: Download uma/secp256k1-nostr library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
uma / secp256k1-nostr example snippets
$text = '
{
"id": "62fa167369a603b1181a49ecf2e20e7189833417c3fb49666c5644901da27bcc",
"pubkey": "84fdf029f065438702b011c2002b489fd00aaea69b18efeae8261c44826a8886",
"created_at": 1689033061,
"kind": 1,
"tags": [],
"content": "This event was created at https://nostrtool.com/ with a throwaway key.",
"sig": "a67e8d286605e3d7dfd3e0bd1642f85a25bb0cd70ec2ed941349ac879f617868a3ffa2a9040bb43c024594a79e4878429a990298c51ae4d6d20533589f4a04df"
}';
$event = json_decode($text);
var_dump(secp256k1_nostr_verify($event->pubkey, $event->id, $event->sig));
// Mangle last half-byte of the signature on purpose
$event->sig[127] = 'e';
var_dump(secp256k1_nostr_verify($event->pubkey, $event->id, $event->sig));