PHPackages                             nuwira/bandrek - 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. nuwira/bandrek

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

nuwira/bandrek
==============

Bandrek is password recovery token generation using number as code for Laravel 5.4.x based.

1.1.1(8y ago)38531MITPHP

Since Jul 29Pushed 8y ago7 watchersCompare

[ Source](https://github.com/Nuwira/bandrek)[ Packagist](https://packagist.org/packages/nuwira/bandrek)[ RSS](/packages/nuwira-bandrek/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (5)Versions (9)Used By (0)

Bandrek
=======

[](#bandrek)

[![Build Status](https://camo.githubusercontent.com/dd40890a308445f8f0b63c8bd39d20cf6621e386ddf85e030900c14ec383db9e/68747470733a2f2f7472617669732d63692e6f72672f4e75776972612f62616e6472656b2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Nuwira/bandrek)[![Total Download](https://camo.githubusercontent.com/ae15c619c33d7a63697a6cb44b7e1aa97fad5bf72a77d862292ff055b9d2be6c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e75776972612f62616e6472656b2e737667)](https://packagist.org/packages/nuwira/bandrek)[![Latest Stable Version](https://camo.githubusercontent.com/dfc033757a33112e83dc4ed31315eb4830aac821cbcb546256bf5f6ac5d6ba2a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e75776972612f62616e6472656b2e737667)](https://packagist.org/packages/nuwira/bandrek)

> **Bandrek** is local word in Javanese that means a **lock pick**. We use lock pick to open a padlock if the key is lost.

Bandrek replaces Laravel's password recovery manager to provide code and token when requesting password recovery. This code can be used as token replacement if you are using REST-API to reset password without visiting web interface.

Bandrek generate 6 random numeric character as code. Bandrek is also creating 64 characters token that can be used in normal web page interface.

The scenario is when user request password recovery via REST-API, the user can send the credentials (e-mail and password) and the easy readable code to reset the password.

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

[](#installation)

Bandrek only supports Laravel 5.4 and above. To install using [Composer](https://getcomposer.org/), just run this command below.

```
composer require nuwira/bandrek
```

Configuration
-------------

[](#configuration)

### Config File

[](#config-file)

After installed, open `config/app.php` and find this line.

```
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class
```

Comment or remove it and add that line to override Laravel's password reset handling.

```
Nuwira\Bandrek\BandrekServiceProvider::class
```

### Add Facade

[](#add-facade)

This is optional. To add Facade, add `config/app.php` in the `aliases` section.

```
'Bandrek' => Nuwira\Bandrek\BandrekFacade::class,
```

If Facade is loaded, you can call these functions

```
Bandrek::getRandomCode($length = 6, $toString = true);
Bandrek::generateToken();
Bandrek::getTokenFromCode($code);
Bandrek::getCodeFromToken($token, $toString = true);
```

### Model File

[](#model-file)

To be able to send reset password instruction e-mail, open `app/User.php` (the user model file) and find this line.

```
use Illuminate\Foundation\Auth\User as Authenticatable;
```

Replace that line with this.

```
use Nuwira\Bandrek\Auth\User as Authenticatable;
```

### Using Custom Notification

[](#using-custom-notification)

Bandrek by default is using e-mail for notification. You can add or replace using your preferred method by extending abstract class `Nuwira\Bandrek\Notification\BandrekNotification`. The token and code are available in `$this->code` and `$this->token` in the notification class.

For example, if you want to send the code using [Gammu SMS notification](https://github.com/laravel-notification-channels/gammu), just install and configure it.

To use SMS and e-mail for code sending, add function in your model that extends `Nuwira\Bandrek\Auth\User` and inject the notification.

**Notification File:** `App\Notifications\ResetPassword.php`

```
namespace App\Notifications;

use Nuwira\Bandrek\Notification\BandrekNotification;
use Illuminate\Notifications\Messages\MailMessage;
use NotificationChannels\Gammu\GammuChannel;
use NotificationChannels\Gammu\GammuMessage;

class ResetPassword extends BandrekNotification
{
    public function via($notifiable)
    {
        return ['mail', GammuChannel::class];
    }

    public function toMail($notifiable)
    {
        return (new MailMessage)
            ->line('You are receiving this email because we received a password reset request for your account.')
            ->action('Reset Password', url(config('app.url').route('password.reset', $this->token, false)))
            ->line('If you did not request a password reset, no further action is required.');
    }

    public function toGammu($notifiable)
    {
        return (new GammuMessage())
            ->to($phoneNumber)
            ->content('To reset password, use this code: '.$this->code);
    }
}
```

**Model File:** `App\User.php`

```
namespace App;

use Nuwira\Bandrek\Auth\User as BaseUser;
use App\Notifications\ResetPassword as ResetPasswordNotification;

class User extends BaseUser
{
    public function sendPasswordResetNotification($token)
    {
        $this->notify(new ResetPasswordNotification($token));
    }
}
```

License
-------

[](#license)

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

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 93.3% 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 ~31 days

Recently: every ~46 days

Total

8

Last Release

2989d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/809de97d088b0eff358f96141a31bd8897216a03175448192de140f2723bdea6?d=identicon)[matriphe](/maintainers/matriphe)

---

Top Contributors

[![matriphe](https://avatars.githubusercontent.com/u/277262?v=4)](https://github.com/matriphe "matriphe (28 commits)")[![fidovandenbos](https://avatars.githubusercontent.com/u/33221140?v=4)](https://github.com/fidovandenbos "fidovandenbos (2 commits)")

---

Tags

authlaravelpasswordlaravelpasswordnuwirabandrek

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/nuwira-bandrek/health.svg)

```
[![Health](https://phpackages.com/badges/nuwira-bandrek/health.svg)](https://phpackages.com/packages/nuwira-bandrek)
```

###  Alternatives

[lab404/laravel-impersonate

Laravel Impersonate is a plugin that allows to you to authenticate as your users.

2.3k16.4M48](/packages/lab404-laravel-impersonate)[santigarcor/laratrust

This package provides a flexible way to add Role-based Permissions to Laravel

2.3k5.4M43](/packages/santigarcor-laratrust)[yebor974/filament-renew-password

Package for manage renew password according to the last renew or other criteria

4482.6k3](/packages/yebor974-filament-renew-password)[martbock/laravel-diceware

Diceware Passphrase Generator for Laravel

3264.7k](/packages/martbock-laravel-diceware)

PHPackages © 2026

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