PHP code example of zbkm / siwe

1. Go to this page and download the library: Download zbkm/siwe 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/ */

    

zbkm / siwe example snippets


$params = new SiweMessageParams(
    address: $address,
    chainId: 1,
    domain: "example.com",
    uri: "https://example.com/path"
);

$params = SiweMessageParamsBuilder::create()
            ->withAddress($address)
            ->withChainId(1)
            ->withDomain("example.com")
            ->withUri("https://example.com/path")->build();

$message = SiweMessage::create($params);

if (SiweMessage::verify($params, $signature)) {
    // authorization success
} else {
    // authorization failed (signature invalid)
}