PHP code example of sschlein / obscure

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

    

sschlein / obscure example snippets


// http://exampleapplication.com/user/ALnLzW

Route::get('/user/{id}', function ($id) {
    return "ID: " . $id; //returns a number
})->middleware('obscure');

    // ...
    Sschlein\Obscure\ObscureServiceProvider::class,
    // ...


protected $routeMiddleware = [
    // ...
    'obscure'         => \Sschlein\Obscure\Middleware\Obscure::class,
    // ...
];


Route::get('/obscure/{user_id}', function ($user_id) {
    return "ID: " . $id; // returns a number
})->middleware('obscure:user_id');

// http://exampleapplication.com/obscure/ALnLzW
// hashed with salt "salt"

Route::get('/obscure/{id}', function ($id) {
    return "ID: " . $id; // returns a number
})->middleware('obscure');

public function store(...)
{
	return redirect('users/' . Obscure::encode(1234));
}
bash
php artisan vendor:publish