1. Go to this page and download the library: Download jenssegers/optimus 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/ */
jenssegers / optimus example snippets
use Jenssegers\Optimus\Optimus;
new Optimus(1580030173, 59260789, 1163945558);
$encoded = $optimus->encode(20); // 1535832388
$original = $optimus->decode(1535832388); // 20
namespace App\Providers;
use Jenssegers\Optimus\Optimus;
use Illuminate\Support\ServiceProvider;
class OptimusServiceProvider extends ServiceProvider
{
public function register()
{
$this->app->singleton(Optimus::class, function ($app) {
return new Optimus(1580030173, 59260789, 1163945558);
});
}
}
namespace App\Http\Controllers;
use Jenssegers\Optimus\Optimus;
use App\Http\Controllers\Controller;
class UserController extends Controller
{
public function show($id, Optimus $optimus)
{
$id = $optimus->decode($id);
}
}