PHP code example of igzard / php-unas-webhook

1. Go to this page and download the library: Download igzard/php-unas-webhook 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/ */

    

igzard / php-unas-webhook example snippets



//Initialize Unas Webhook with your Unas shop HMAC secret and request header UNAS hmac
use Igzard\PhpUnasWebhook\UnasWebhook;

$webhook = new UnasWebhook([
    'hmac' => 'your-unas-shop-hmac-secret',
    'hmac_header' => 'Hmac secret from http header e.g: $_SERVER["HTTP_X_UNAS_HMAC"]'
]);

//Process incoming webhook request
$unasOrder = $webhook->process("{'message':'Unas request json'}");

//Get order data eg. order number
$orderNumber = $unasOrder->getOrderId()->getValue(); //return with unas webshop order number string

//or get customer data
$customer = $unasOrder->getCustomer(); //return with Customer data object

//etc.

//processing Unas Order with your domain logic...

bash
composer