Download the PHP package webekspres/fonte-otp without Composer
On this page you can find all versions of the php package webekspres/fonte-otp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download webekspres/fonte-otp
More information about webekspres/fonte-otp
Files in webekspres/fonte-otp
Package fonte-otp
Short Description Laravel package to send WhatsApp OTP via Fonnte API, supporting Laravel 8–12.
License MIT
Informations about the package fonte-otp
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
- 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
- PHP 7.4 or higher
- Laravel 8, 9, 10, 11, or 12
- GuzzleHttp client
Installation
You can install the package via composer:
After installation, run the following command to publish the configuration and migration files:
Run the migrations:
Configuration
The package will automatically add the following environment variables to your .env file:
You need to fill in your Fonnte API token in the FONNTE_TOKEN variable.
Publishing Configuration (Optional)
If you want to customize the configuration, you can publish the config file:
Complete Implementation Examples
Basic Usage in Controller
Protected Route with OTP Middleware
Custom Event Listeners
Register the listener in app/Providers/EventServiceProvider.php:
API Resource Implementation
Usage
Sending OTP
Verifying OTP
Using the Rate Limiter Middleware
You can protect your OTP endpoints with the built-in rate limiter:
Using the OTP Verification Middleware
You can verify OTPs automatically with the built-in middleware:
Command Line Usage with Variables
Documentation
For more detailed information, please refer to the following documentation files:
- API Documentation - Detailed documentation for all public methods
- Configuration - Configuration options and environment variables
- Events - Event system and how to listen to OTP events
- Facade - How to use the facade for convenient access
- Installation - Detailed installation instructions
- Middleware - Middleware usage for protecting routes
- Testing - How to test the package functionality
- Usage - Comprehensive usage examples
Events
The package fires the following events:
OtpGenerated- When an OTP is generatedOtpSent- When an OTP is successfully sentOtpVerified- When an OTP is verified
You can listen to these events in your EventServiceProvider:
Security
- OTPs are stored encrypted in the database
- Rate limiting prevents spam
- Fonnte token is stored in environment variables only
- Automatic retry mechanism for failed requests
Customization
Message Template
You can customize the OTP message template by changing the FONNTE_MESSAGE_TEMPLATE environment variable:
The following placeholders are available:
{code}- The OTP code{expiry}- The expiry time in minutes{name}- User's name (when provided){action}- The action being performed (when provided){company_name}- Company name from config{support_email}- Support email from config{app_name}- App name from config
OTP Expiry
Change the OTP expiry time (in minutes) with the FONNTE_OTP_EXPIRY environment variable:
Retry Settings
Configure retry settings for failed requests:
Testing
To run tests, execute:
Developed By
Developed by Fadhila36
Powered By
Powered by Webekspres
License
The MIT License (MIT). Please see License File for more information.
All versions of fonte-otp with dependencies
illuminate/support Version ^8.0|^9.0|^10.0|^11.0|^12.0
guzzlehttp/guzzle Version ^7.0|^8.0