PHP code example of krowinski / tinyid
1. Go to this page and download the library: Download krowinski/tinyid 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/ */
krowinski / tinyid example snippets
use TinyID\TinyID;
sist of at least two UNIQUE unicode characters.
$tinyId = new TinyID('2BjLhRduC6Tb8Q5cEk9oxnFaWUDpOlGAgwYzNre7tI4yqPvXm0KSV1fJs3ZiHM');
var_dump($tinyId->encode('48888851145')); // will print 1FN7Ab
var_dump($tinyId->decode('1FN7Ab')); // will print '48888851145'
var_dump((new TinyID('0123456789ABCDEFGH'))->encode('48888851145')); // '47F709HFF'
var_dump((new TinyID('😀😁😂😃😄😅😆😇😈😉😊😋😌😍😎😏😐😑😒😓😔😕😖😗😘😙😚😛😜😝😞😟😠😡😢😣😤😥😦😧😨😩😪😫😬😭😮😯😰😱😲😳😴😵😶😷😸😹😺😻😼😽😾😿'))->encode(48888851145)); // '😭😢😀😊😫😉'