Filament - Using Phone Instead of Email - With Vonage SMS

Filament 3

Change the typical login workflow with email to more secure flow using phone number, password and one time token sent via SMS message.

FilamentExamples ThumbBase (5)

Get the Source Code:

Only This Example

$9

One-time payment

Full source code for Filament - Using Phone Instead of Email - With Vonage SMS
Downloadable ZIP file with the source code
Lifetime access to this example
GitHub Sign in with GitHub to buy

Sign in first, then complete your $9 checkout.

Best value — all 169 examples

FilamentExamples Membership

$99 /year
or
$199 lifetime
Access to code of all 169 examples
Future new examples and updates included
FilaCheck Pro package licence included
MCP server included
View membership plans

30-day money-back guarantee

How it works

For this example, the authentication system uses phone numbers and SMS OTPs via Vonage.

The User Model is updated to store phone and OTP-related fields. The native Laravel MustVerifyEmail is enabled but some methods are overwritten to use phone instead of email.

app/Models/User.php:

use Illuminate\Contracts\Auth\MustVerifyEmail;
use Filament\Panel;
use Illuminate\Notifications\Notification;
use Filament\Models\Contracts\FilamentUser;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
 
class User extends Authenticatable implements MustVerifyEmail, FilamentUser
{
use HasFactory, Notifiable;
 
protected $fillable = [
'name',
'phone',
'password',
'verified_at',
'otp_code',
'otp_expires_at',
];
 
protected $hidden = [
'password',
'remember_token',
'otp_code',
];
 
protected function casts(): array
{
return [
'verified_at' => 'datetime',
'otp_expires_at' => 'datetime',
'password' => 'hashed',
'otp_code' => 'integer',
];
}
 
public function canAccessPanel(Panel $panel): bool
{
return true;
}
 
public function hasVerifiedEmail(): bool
{
return ! is_null($this->verified_at);
}
 
public function getEmailForVerification(): string
{
return $this->phone;
}
 
public function routeNotificationForVonage(Notification $notification): string
{
return $this->phone;
}
}

Filament Panel

All authentication features are enabled in the Panel Provider and every feature have a custom page for adding phone field and overwriting some Filament logic.

Next, we will:

  • Implement Custom Login/Registration pages
  • Add Phone Verification Prompt
  • Change Password reset flow
  • Add profile page to change the phone number

In the end, we will have an application that sens SMS message with one time password (OTP) for authentication confirmation.

The FULL tutorial is available after the purchase: in the Readme file of the official repository you would get invited to.