PHP code example of cbenjafield / laravel-password-manager
1. Go to this page and download the library: Download cbenjafield/laravel-password-manager 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/ */
cbenjafield / laravel-password-manager example snippets
namespace App\Http\Controllers;
use Benjafield\LaravelPasswordManager\PasswordManager;
use Illuminate\Http\Request;
class PasswordController extends Controller
{
public function store(Request $request, PasswordManager $passwords)
{
$request->validate([
'name' => ['
}
}
use Benjafield\LaravelPasswordManager\Facades\PasswordsFacade;
$password = PasswordsFacade::encrypt($request->name, $request->password);
// Call the save method to store the password in the database.
$password->save();
use Benjafield\LaravelPasswordManager\PasswordManager;
use Benjafield\LaravelPasswordManager\Password;
public function show(int $id, PasswordManager $passwords)
{
// Retrieve the password from the database.
$password = Password::findOrFail($id);
// Decrypt the password back into the original string.
$decrypted = $passwords->decrypt($password->dynamic, $password->password);
}