PHPackages                             patrikgrinsvall/laravel-bankid - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. patrikgrinsvall/laravel-bankid

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

patrikgrinsvall/laravel-bankid
==============================

Swedish BankId integration for Laravel 8

v0.2.0(5y ago)0714MITPHPPHP ^7.4 | ^8.0

Since May 8Pushed 3y ago1 watchersCompare

[ Source](https://github.com/Patrikgrinsvall/laravel-bankid)[ Packagist](https://packagist.org/packages/patrikgrinsvall/laravel-bankid)[ Docs](https://github.com/patrikgrinsvall/laravel-bankid)[ GitHub Sponsors](https://github.com/patrikgrinsvall)[ RSS](/packages/patrikgrinsvall-laravel-bankid/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (2)Dependencies (9)Versions (5)Used By (0)

While this package is free to use, you can hire help of integrating it, contact

Swedish BankID for Laravel 8 with Livewire
------------------------------------------

[](#swedish-bankid-for-laravel-8-with-livewire)

You will need laravel 8 to use route facade but it might work with earlier versions when using middleware. Livewire is a required dependency so it will be installed. I think however its possible to quite easy call the service from another controller action and it will work quite well.

Anyway, there are a plenthora of improvements to be made to this project but it is used in production for atleast one company. PRs are very welcome.

Installation
------------

[](#installation)

Composer:

```
composer require patrikgrinsvall/laravel-bankid
```

- Publish the config, views and transaltions with

```
php artisan vendor:publish --provider="Patrikgrinsvall\LaravelBankid\LaravelBankidServiceProvider"

```

- Then check in `app/config/bankid.php` for info on how to add your own certificates.
- Views will be editable in your views directory
- Translations will be editable in defauit translations directory. Swedish and English are provided with package.
-

Usage
-----

[](#usage)

- Service provider should be auto discovered since larvel 8 so no need to register service provider.
- However i have noticed in many cases this does not work so usually:
- Register service provider `Patrikgrinsvall\LaravelBankid\BankidServiceProvider` in `config/app.php`

**There are a few different ways to use this package**

1. Use the supplied Route macro:

```
// You can change the route prefix '/bankid' to whatever you want, for example /login.
// This is then the entrypoint for where users should be sent to start authentication.
// This line of code should be placed in routes.
Route::LaravelBankid('/bankid');

```

2. As a facade (this might work, dont remember.)

```
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.

```

3. As a middleware, first register in App\\Http\\Kernel class: (WIP! Dont use yet!)

```
protected $routeMiddleware = [
    'bankid' => \Patrikgrinsvall\LaravelBankid\BankidMiddleware::class,

```

Then use in one of the following ways:

```
// 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'))
});

```

Retrieve authenticated user.
----------------------------

[](#retrieve-authenticated-user)

```
// Get the user from the session
use Illuminate\Support\Facades\Session;
...
Session::get('bankid.user');            // returns user details as an array
Session::get('bankid.personalNumber');  // returns personal number as a string
Session::get('bankid.name');            // returns full name as a string
Session::get('bankid.givenName');       // returns first name as a string
Session::get('bankid.surname');         // returns lastn name as string
Session::get('bankid.signature');       // returns signature as string.

```

From facade:

```
use Patrikgrinsvall\LaravelBankid\BankidFacade;
...
Bankid::user();

```

Testing
-------

[](#testing)

```
composer test
```

Final notes.
------------

[](#final-notes)

- Basic authentication works for mobile devices.
- But alot in this package is not finished i will continue to iterate over it when need arises.
- PRs are welcome!
- Sign is not working.
- QR is not working.
- Same device is not working (bankid on fil)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

25

—

LowBetter than 36% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 67.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~239 days

Total

3

Last Release

1369d ago

Major Versions

v0.2.0 → v9.0.0.x-dev2022-09-26

PHP version history (2 changes)v0.1.0PHP ^8.0

v0.2.0PHP ^7.4 | ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2749942?v=4)[Patrik Grinsvall](/maintainers/patrikgrinsvall)[@Patrikgrinsvall](https://github.com/Patrikgrinsvall)

---

Top Contributors

[![silentpatrik](https://avatars.githubusercontent.com/u/77385235?v=4)](https://github.com/silentpatrik "silentpatrik (25 commits)")[![Patrikgrinsvall](https://avatars.githubusercontent.com/u/2749942?v=4)](https://github.com/Patrikgrinsvall "Patrikgrinsvall (10 commits)")[![iamlasse](https://avatars.githubusercontent.com/u/556886?v=4)](https://github.com/iamlasse "iamlasse (1 commits)")[![silentridge](https://avatars.githubusercontent.com/u/85770981?v=4)](https://github.com/silentridge "silentridge (1 commits)")

---

Tags

bankidbankid-swedencomposer-packagelaravellaravel-frameworklaravel-packagelaravel8laravel8xswedish-bankswedish-bankidswedish-bankid-apiswedish-eidlaravelbank-idbankidswedish bankidsvenskt bankidfiansiell id teknik

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/patrikgrinsvall-laravel-bankid/health.svg)

```
[![Health](https://phpackages.com/badges/patrikgrinsvall-laravel-bankid/health.svg)](https://phpackages.com/packages/patrikgrinsvall-laravel-bankid)
```

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k98.0M1.3k](/packages/spatie-laravel-permission)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.3M42](/packages/spatie-laravel-pdf)[spatie/laravel-passkeys

Use passkeys in your Laravel app

470755.5k32](/packages/spatie-laravel-passkeys)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3913.7k](/packages/rawilk-profile-filament-plugin)[filament/support

Core helper methods and foundation code for all Filament packages.

2328.3M218](/packages/filament-support)[masterix21/laravel-licensing

Laravel licensing package with polymorphic assignment to any model, activation keys, expirations/renewals, and seat control via LicenseUsage. Supports offline verification with public-key–signed tokens, a CLI to generate/rotate/revoke keys, and an extensible architecture via config and contracts.

1542.1k4](/packages/masterix21-laravel-licensing)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
