PHP code example of patrikgrinsvall / laravel-bankid
1. Go to this page and download the library: Download patrikgrinsvall/laravel-bankid 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/ */
use Patrikgrinsvall\LaravelBankid\BankidFacade;
...
Bankid::login(); // will redirect user and start a login. After login user is returned to url in config/bankid.php
Bankid::user(); // returns the user previously logged in or false.
// On a single route
Route::get('/profile', function () {
// your stuff
})->middleware('bankid');
// On a group of routes
Route::middleware([BankidMiddleware::class])->group(function () {
Route::get('/your-route', View::render('your-route'))
});
// On a group of routes without adding to kernel
Route::middleware([\Patrikgrinsvall\LaravelBankid\BankidMiddleware::class])->group(function () {
Route::get('/your-route', View::render('your-route'))
});
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.