1. Go to this page and download the library: Download trianity/laravel-sqids 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/ */
use Trianity\Sqids\Facades\Sqids;
$id = Sqids::encode([4815162342]);
$numbers = Sqids::decode($id);
use Trianity\Sqids\SqidsFactory;
final class LinkController
{
public function show(SqidsFactory $sqids, string $id): array
{
return $sqids->decode($id);
}
}
use Trianity\Sqids\SqidsFactory;
$sqids = new SqidsFactory(minLength: 24);
$id = $sqids->encode([1, 2, 3]);