1. Go to this page and download the library: Download 96qbhy/hyid 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/ */
96qbhy / hyid example snippets
class User extends Model{
use Qbhy\Hyid\HyidAble;
// or
public function getUserId($userId){
return hyid($userId);
}
// or
public function toArray(){
$data = parent::toArray();
$data['id'] = hyid()->encode($data['id']);
return $data;
}
}
// decode
public function userinfo($id){
return User::query()->findOrFail(hyid()->decode($id))->toArray();
}