PHP code example of skyzyx / signer

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

    

skyzyx / signer example snippets


use Skyzyx\Signer\Signer;

$self_key = 'Skyzyx';
$client_id = 'k3qDQy0Tr56v1ceo';
$client_secret = 'O5j@pG@Jt%AzyiJTEfo!£LSz8yqSj)JX)S6FvW%58KjlS9bc%Fi7&&C4KSCT8hxd';

$signer = new Signer($self_key, $client_id, $client_secret, 'sha512');
$signature = $signer->sign([
    'ClientID' => $client_id,
    'Domain'   => 'foo.com',
    'Path'     => '/',
    'Expires'  => 'Wed, 13 Jan 2021 22:23:01 GMT',
    'Secure'   => null,
    'HttpOnly' => null,
]);

$signature = wordwrap($signature, 64, "\n", true);
#=> dfbffab5b6f7156402da8147886bba3eba67bd5baf2e780ba9d39e8437db7c47
#=> 35e9a0b834aa21ac76f98da8c52a2a0cd1b0192d0f0df5c98e3848b1b2e1a037



use Monolog\Logger;
use Monolog\Handler\StreamHandler;
use Skyzyx\Signer\Signer;

// create a log channel
$log = new Logger('name');
$log->pushHandler(new StreamHandler('path/to/your.log', Logger::DEBUG));

// inject a logger
$signer = new Signer();
$signer->setLogger($log);

$signer->sign( ... );