PHPackages                             codedive-io/laravel-code-verification - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. codedive-io/laravel-code-verification

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

codedive-io/laravel-code-verification
=====================================

v1.0.2(7mo ago)06MITPHPPHP ^8.1

Since Sep 29Pushed 7mo agoCompare

[ Source](https://github.com/codedive-io/laravel-code-verification)[ Packagist](https://packagist.org/packages/codedive-io/laravel-code-verification)[ RSS](/packages/codedive-io-laravel-code-verification/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (7)Used By (0)

Laravel Code Verification
=========================

[](#laravel-code-verification)

A package for issuing and verifying temporary confirmation codes for users in a Laravel application. It can be used for various purposes such as password reset, email or phone number verification, and two-factor authentication.

Key Features
------------

[](#key-features)

- Code Issuance : Generate a unique confirmation code for a specific recipient (e.g., email, phone number)
- Code Verification : Validates whether the issued code is correct, not expired, and has not exceeded the maximum number of attempts.
- Event-Driven : Events are fired upon code issuance, verification, or revocation, allowing for easy integration with you business logic.

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

[](#installation)

Install the package using Composer.

```
composer require codedive-io/laravel-code-verification
```

Database Migration

After installing the package, you need to run the migrations to create the `verification_codes` table. The migrations are automatically loaded by the service provider.

```
php artisan migrate
```

Usage
-----

[](#usage)

### 1. Code Issuance

[](#1-code-issuance)

Use the `issue` method of the `CodeVerificationService` to issue a confirmation code.

**Using the Service**

```
use Codedive\LaravelCodeVerification\CodeVerificationService;

$service = app(CodeVerificationService::class);

$verificationCode = $service->issue(
    $receiver = 'user@example.com',
    $purpose = 'verify_email',
    $userId = 1
)
```

**Using the Facades**

```
use Codedive\LaravelCodeVerification\CodeVerification;

CodeVerification::issue(
    $receiver = 'user@example.com',
    $purpose = 'verify_email',
    $userId = 1
);
```

### 2. Code Verification

[](#2-code-verification)

Use the `verify` method to validate the code entered by the user.

**Using the Services**

```
use Codedive\LaravelCodeVerification\CodeVerificationService;

$service = app(CodeVerificationService::class);

$isVerified = $service->verify(
    $receiver = 'user@example.com',
    $purpose = 'verify_email',
    $user_id = 1,
    $code = '123456'
);

if ($isVerified) {
    // The code was successfully verified
} else {
    // Code verification failed
}
```

**Using the Facades**

```
use Codedive\LaravelCodeVerification\CodeVerification;

$isVerified = CodeVerification::verify(
    $receiver = 'user@example.com',
    $purpose = 'verify_email',
    $user_id = 1,
    $code = '123456'
);
```

### 3. Event

[](#3-event)

You can listen for the following events when they are triggered:

- When issued : `CodeIssuedEvent`
- When Verified : `CodeVerifiedEvent`
- When Revoked : `CodeRevokedEvent`

### 4. Configuration

[](#4-configuration)

If you need, you can publish configuration file.

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

You can change the configuration values through the `config/code_verification.php` file.

```
return [
    'code_length' => 6,     // Length of the generated code
    'expires_in' => 300,    // Code expiration time (in seconds)
    'max_attempts' => 3,    // Maximum number of attempts
];
```

Uninstall Package
-----------------

[](#uninstall-package)

Rollback the specific migration

```
php artisan migrate:rollback --path=/vendor/codedive-io/laravel-code-verification/database/migration
```

Uninstall the package using Composer.

```
composer remove codedive-io/laravel-code-verification
```

Contribution
------------

[](#contribution)

Bug reports, feature suggestions, and pull requests are welcome. You can contribute via the [Github Repository](https://github.com/codedive-io/laravel-code-verification).

LICENSE
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](LICENSE).

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance62

Regular maintenance activity

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 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

Every ~0 days

Total

6

Last Release

232d ago

PHP version history (2 changes)1.0.0.x-devPHP ^8.0

1.0.2.x-devPHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/d773f18d80a95bbe881cc89084f74703bce3cbf285b1afd745f3cc61f428c3dd?d=identicon)[foxtrot](/maintainers/foxtrot)

---

Top Contributors

[![foxtrot-codedive](https://avatars.githubusercontent.com/u/234982537?v=4)](https://github.com/foxtrot-codedive "foxtrot-codedive (3 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/codedive-io-laravel-code-verification/health.svg)

```
[![Health](https://phpackages.com/badges/codedive-io-laravel-code-verification/health.svg)](https://phpackages.com/packages/codedive-io-laravel-code-verification)
```

###  Alternatives

[carsdotcom/laravel-json-schema

Json Schema validation for Laravel projects

1036.7k3](/packages/carsdotcom-laravel-json-schema)

PHPackages © 2026

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