PHP code example of hinet / laravel-invitecode

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

    

hinet / laravel-invitecode example snippets



return   [
    'length' => 6, //邀请码长度
    'char' => '',//生成邀请码的字符,默认a-zA-Z0-9
    'salt' => '',//加密盐,默认使用APP_KEY
];

namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use InviteCode;
class DemoController extends Controller{
    public function index(){
        echo InviteCode::enCode(123);
        //print NDZ0kA
        //echo echo InviteCode::deCode('NDZ0kA');
        //print 123
    }
}

php artisan vendor:publish --tag=invitecode