1. Go to this page and download the library: Download irfa/php-sn-generator 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/ */
return [
/*
|--------------------------------------------------------------------------
| Serial Config
|--------------------------------------------------------------------------
|
| length : length for one segment
| segment : segment amount for Serial number
| seperator : striped segment for serial (set null if you do not wish to use seperator)
|
*/
'length' => 4,
'segment' => 4,
'seperator' => "-",
'charset' => "0123456789ABCDEFGHIJKLMNPQRSTUWXYZ",
];
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use SN;
class SomethingController extends Controller
{
public function generate_serial(Request $request)
{
return SN::generate(); //result : TP8K-XU63-9YN3-SMSF
}
}
a\SerialNumber\Func\SerialNumber;
$sn = new SerialNumber();
echo $sn->generate(); //result : TP8K-XU63-9YN3-SMSF