PHPackages                             authentica/authentica - 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. authentica/authentica

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

authentica/authentica
=====================

Official Laravel package for Authentica API (OTP, Face, Voice verification)

v1.0.0(2mo ago)002MITPHPPHP ^8.0

Since Apr 9Pushed 2mo agoCompare

[ Source](https://github.com/YacoubAl-hardari/authentica)[ Packagist](https://packagist.org/packages/authentica/authentica)[ RSS](/packages/authentica-authentica/feed)WikiDiscussions master Synced 2w ago

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

[![alt text](authentica.png)](authentica.png)

Authentica Laravel Package
==========================

[](#authentica-laravel-package)

Easily integrate Authentica's secure authentication (OTP, Face, Voice, SMS) into your Laravel app.

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

[](#installation)

```
composer require authentica/authentica
```

Publish Configuration
---------------------

[](#publish-configuration)

```
php artisan vendor:publish --tag=authentica-config
```

Or publish all vendor configs:

```
php artisan vendor:publish --tag=config
```

Environment Setup
-----------------

[](#environment-setup)

Add the following to your `.env` file (see `.env.example` for all options):

```
AUTHENTICA_API_KEY=your_api_key_here
AUTHENTICA_BASE_URL=https://api.authentica.sa/api/v2
AUTHENTICA_DEFAULT_CHANNEL=sms # sms, whatsapp, email
AUTHENTICA_FALLBACK_CHANNEL=email # optional
AUTHENTICA_DEFAULT_TEMPLATE_ID=31 # optional, default: 1
AUTHENTICA_FALLBACK_TEMPLATE_ID=2 # optional, default: 2
AUTHENTICA_DEFAULT_SENDER_NAME=MyBrand # optional
AUTHENTICA_DEFAULT_EMAIL=your@email.com # optional

```

Usage
-----

[](#usage)

Import the facade at the top of your file:

```
use Authentica\LaravelAuthentica\Facades\Authentica;
```

### Send OTP with Fallback

[](#send-otp-with-fallback)

```
Authentica::sendOtp([
    'phone' => '+966551234567',
    'method' => 'sms',
    'otp' => '123456', // Optional custom OTP
    'fallback_email' => 'user@example.com', // Optional fallback
]);
```

### Verify OTP

[](#verify-otp)

```
$result = Authentica::verifyOtp('123456', '+966551234567');
if ($result->successful()) {
    // Authentication successful
}
```

### Face Verification

[](#face-verification)

```
$result = Authentica::verifyFace(
    'user_123',
    Authentica::fileToBase64(storage_path('app/faces/reference.jpg')),
    Authentica::fileToBase64(storage_path('app/faces/capture.jpg'))
);
if ($result->successful()) {
    // Face match successful
} else {
    // Handle failed verification
    $error = $result->message();
}
```

### Voice Verification

[](#voice-verification)

```
$result = Authentica::verifyVoice(
    'user_123',
    Authentica::fileToBase64(storage_path('app/voice/reference.wav')),
    Authentica::fileToBase64(storage_path('app/voice/capture.wav'))
);
if ($result->successful()) {
    // Voice match successful
} else {
    // Handle failed verification
    $error = $result->message();
}
```

---

Practical Scenario: Face &amp; Voice Verification
-------------------------------------------------

[](#practical-scenario-face--voice-verification)

### Example: User Login with Face or Voice

[](#example-user-login-with-face-or-voice)

1. **User uploads or captures a reference image/audio during registration.**
    - Store the reference file securely (e.g., in `storage/app/faces/` or `storage/app/voice/`).
2. **User attempts to log in and provides a real-time image or audio.**
3. **Convert both files to Base64:**```
    $referenceBase64 = Authentica::fileToBase64($referencePath); // e.g., reference.jpg or reference.wav
    $queryBase64 = Authentica::fileToBase64($queryPath); // e.g., capture.jpg or capture.wav
    ```
4. **Call the verification method:**
    - Face: ```
        $result = Authentica::verifyFace($userId, $referenceBase64, $queryBase64);
        ```
    - Voice: ```
        $result = Authentica::verifyVoice($userId, $referenceBase64, $queryBase64);
        ```
5. **Check the result:**```
    if ($result->successful()) {
        // Allow login or next step
    } else {
        // Show error message to user
        $error = $result->message();
    }
    ```

### Notes

[](#notes)

- Both methods validate input and handle errors (invalid Base64, missing user ID, file too large, etc.).
- The response object provides helpers: `successful()`, `data()`, `message()`, etc.
- Always handle possible errors and inform the user accordingly.

---

### Send Custom SMS

[](#send-custom-sms)

```
Authentica::sendSms(
    '+966551234567',
    'Your order #12345 has shipped!',
    'MyBrand' // Registered sender name
);
```

### Get Balance

[](#get-balance)

```
$balance = Authentica::getBalance()->credits;
```

Advanced
--------

[](#advanced)

- You can inject `AuthenticaClient` directly if you prefer dependency injection.
- All methods return an `AuthenticaResponse` object with helpers like `successful()`, `data()`, `message()`, etc.

Troubleshooting
---------------

[](#troubleshooting)

- Ensure you have published the config and set all required `.env` variables.
- For more details, see the [Authentica API documentation](https://portal.authentica.sa/docs/).

---

Support
-------

[](#support)

For technical inquiries:

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance85

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

79d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1fb3960cf6e949bc5401902a09bf597da5bf4aeaf53c382bb55b1843769c0347?d=identicon)[Yacoub\_Al-haidari](/maintainers/Yacoub_Al-haidari)

---

Top Contributors

[![YacoubAl-hardari](https://avatars.githubusercontent.com/u/94101869?v=4)](https://github.com/YacoubAl-hardari "YacoubAl-hardari (3 commits)")

---

Tags

laravel-otplaravel-smsotpotp-emailotp-smssmssms-providerwhatsapp-otplaravelotpsmsverificationbiometricsauthentica

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-health

Monitor the health of a Laravel application

87411.3M153](/packages/spatie-laravel-health)[ellaisys/aws-cognito

AWS Cognito package that allows Auth and other related features using the AWS SDK for PHP

121242.9k1](/packages/ellaisys-aws-cognito)[rahul900day/laravel-captcha

Different types of Captcha implementation for Laravel Application.

10920.2k](/packages/rahul900day-laravel-captcha)[rinvex/laravel-authy

Rinvex Authy is a simple wrapper for Authy TOTP, the best rated Two-Factor Authentication service for consumers, simplest 2fa Rest API for developers and a strong authentication platform for the enterprise.

3277.0k1](/packages/rinvex-laravel-authy)[craftsys/msg91-laravel

Laravel service provider for Msg91 apis to Send OTPs, Verify OTPs, Resend OTPs, Send SMS (Short Message) etc

12101.0k2](/packages/craftsys-msg91-laravel)

PHPackages © 2026

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