PHP code example of tiny-blocks / ksuid

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

    

tiny-blocks / ksuid example snippets


$ksuid = Ksuid::random();

$ksuid->getValue();     # 2QzPUGEaAKHhVcQYrqQodbiZat1
$ksuid->getPayload();   # 464932c1194da98e752145d72b8f0aab
$ksuid->getUnixTime();  # 1686353450
$ksuid->getTimestamp(); # 286353450


Ksuid::from(payload: hex2bin('9850EEEC191BF4FF26F99315CE43B0C8'), timestamp: 286235327);

Ksuid::fromPayload(value: '0o5Fs0EELR0fUjHjbCnEtdUwQe3');

Ksuid::fromTimestamp(value: 286235327);

$ksuid = Ksuid::inspectFrom(ksuid: '2QzPUGEaAKHhVcQYrqQodbiZat1'); # Array
                                                                   # (
                                                                   #    [time] => 2023-06-09 20:30:50 -0300 -03
                                                                   #    [payload] => 464932c1194da98e752145d72b8f0aab
                                                                   #    [timestamp] => 286353450
                                                                   # )