PHP code example of jetfueltw / signer-php

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

    

jetfueltw / signer-php example snippets


composer 

$appId = 'ffe877812ab842a1bc30b27751bbd6ac';
$appSecret = '381ec44adb8347c68ea0eb4d43212dab';
$timestamp = (new DateTime())->getTimestamp(); // 1499158061
$baseUrl = 'https://example.app/api/v1/players';
$parameters = [
    'title'  => 'title',
    'author' => 'author',
];
$content = json_encode([
    'title'      => 'An encoded string!',
    'bar'        => [
        'sort'   => 79,
        'status' => 'ok',
    ],
    'publish_at' => 123546987,
    'numbers'    => [98, 23, 45, 78],
    'desc'       => 'Dogs, Cats & Mice',
]);

$signature = Signer::sign($appId, $appSecret, $timestamp, $method, $baseUrl, $parameters, $content);
// $signature === 'ipvDjcBgv5mt1SHhmJ7TM6nPhKz/Nwc/B8VsGNyY1Vs=';