PHPackages                             webekspres/fonte-otp - 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. webekspres/fonte-otp

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

webekspres/fonte-otp
====================

Laravel package to send WhatsApp OTP via Fonnte API, supporting Laravel 8–12.

v1.1.0(7mo ago)11MITPHPPHP ^7.4|^8.0|^8.1|^8.2|^8.3

Since Oct 7Pushed 7mo agoCompare

[ Source](https://github.com/Webekspres/fonte-otp)[ Packagist](https://packagist.org/packages/webekspres/fonte-otp)[ RSS](/packages/webekspres-fonte-otp/feed)WikiDiscussions main Synced 1mo ago

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

Fonnte OTP Package for Laravel
==============================

[](#fonnte-otp-package-for-laravel)

This package provides an easy way to send OTP (One-Time Password) via WhatsApp using the Fonnte API in Laravel applications. It supports Laravel 8, 9, 10, 11, and 12.

Features
--------

[](#features)

- Send OTP via WhatsApp using Fonnte API
- Automatic environment setup
- Configurable OTP expiry time
- Rate limiting to prevent spam
- Event system for OTP actions
- Easy to extend and customize
- Automatic retry mechanism for failed requests
- Compatible with Laravel 8-12
- Dynamic message formatting with custom variables

Requirements
------------

[](#requirements)

- PHP 7.4 or higher
- Laravel 8, 9, 10, 11, or 12
- GuzzleHttp client

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

[](#installation)

You can install the package via composer:

```
composer require webekspres/fonte-otp
```

After installation, run the following command to publish the configuration and migration files:

```
php artisan fonnte:install
```

Run the migrations:

```
php artisan migrate
```

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

[](#configuration)

The package will automatically add the following environment variables to your `.env` file:

```
FONNTE_TOKEN=
FONNTE_OTP_EXPIRY=5
FONNTE_MESSAGE_TEMPLATE="Kode OTP Anda adalah {code}"
FONNTE_MAX_RETRIES=3
FONNTE_RETRY_DELAY=1000
FONNTE_OTP_MAX_ATTEMPTS=3
FONNTE_OTP_DECAY_MINUTES=10
FONNTE_COMPANY_NAME=Our Company
FONNTE_SUPPORT_EMAIL=support@example.com
FONNTE_APP_NAME=Our App
```

You need to fill in your Fonnte API token in the `FONNTE_TOKEN` variable.

### Publishing Configuration (Optional)

[](#publishing-configuration-optional)

If you want to customize the configuration, you can publish the config file:

```
php artisan vendor:publish --provider="Webekspres\FonnteOtp\Providers\FonnteOtpServiceProvider" --tag="fonnte-otp-config"
```

Complete Implementation Examples
--------------------------------

[](#complete-implementation-examples)

### Basic Usage in Controller

[](#basic-usage-in-controller)

```
