Source: chrysanthos.xyz

? SMS OTP Verification for Laravel
In some occasions you may need to add OTP verification for your logged-in dashboard. Various ways exist for OTP verification (like Laravel https://jetstream.laravel.com//https://laravel.com/docs/9.x/fortify) which will require your end user to have a separate mobile app for this.

The package provides an easy way to add SMS OTP verification to your app.

The Laravel OTP package by default listens to the Login event to send a notification to the user.

generateOtpAndSend($request->user()); return response()->noContent(); } public function check(Request $request) { $request->validate([ 'otp' => ['required', 'numeric'], ]); $otpValid = app(OtpService::class)->check($request->user(), $request->get('otp')); throw_unless($otpValid, ValidationException::withMessages([ 'otp' => 'Invalid otp!', ])); return back(); } public function resend(Request $request) { app(OtpService::class)->generateOtpAndSend($request->user()); return back(); }}
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners