PHPackages                             fragotesac/zf1-2fa - 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. [Framework](/categories/framework)
4. /
5. fragotesac/zf1-2fa

ActiveLibrary[Framework](/categories/framework)

fragotesac/zf1-2fa
==================

Zend Framework 1 2FA component

v1.5(1y ago)029BSD-3-ClauseJavaScriptPHP ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0

Since Jan 15Pushed 1y ago1 watchersCompare

[ Source](https://github.com/fragotesac/zf1-2fa)[ Packagist](https://packagist.org/packages/fragotesac/zf1-2fa)[ Docs](http://framework.zend.com/)[ RSS](/packages/fragotesac-zf1-2fa/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (8)Used By (0)

Zend Framework 1 Two-Factor Authentication (2FA) Library
========================================================

[](#zend-framework-1-two-factor-authentication-2fa-library)

This PHP library provides two-factor authentication (2FA) functionality for Zend Framework 1 applications. It allows for secure user login by requiring an additional step of verification, enhancing application security.

How to Use
----------

[](#how-to-use)

### Backend Configuration

[](#backend-configuration)

1. **Create an Action:**
    Implement an action in your backend where 2FA will be handled.
2. **Instantiate the 2FA Service:**

```
    $this->tfa = new \Zend\TwoFactorAuth();
```

3. **Set Mail Configuration:**

```
    $this->tfa->setMailConfig([
        'transport' => [],      // Mail transport settings
        'subject'   => '',      // Email subject for 2FA codes
        'from'      => ['email' => '', 'name' => ''],  // Sender details
        'template'  => []       // Email template configuration
    ]);
```

4. **Initialize the 2FA Service:**Call the init method with a callback function to validate the user:

```
    $this->tfa->init([$this, 'checkUser']);
```

5. **Implement the checkUser Method:**This method should handle user validation and error management using `Zend\Util\ResponseUtil`.

### Client-Side Setup

[](#client-side-setup)

1. **Copy the Client Folder:**
    Copy the `2fa-client` folder located inside `src` and place it in your `public/js/` directory.
2. **Initialize the 2FA Client:**
    Use the following JavaScript code to initialize the 2FA client:

```
   zfTwoFactorAuth.init(apiUrl, data, 'glass-theme', (loginFormData, url) => {
        // Handle the login callback here
   });
```

- `apiUrl`: The API endpoint previously created for 2FA.
- `data`: The login form fields converted into an object, e.g., {username: 'joe', password: 123456}.
- `glass-theme`: The style theme for the 2FA modal. Available themes are: `glass-theme` `cds-theme`
- `Callback Function`: Handles the login URL and sanitized parameters.

### Requirements

[](#requirements)

- Zend Framework 1
- PHP 8.0 or higher
- Composer for dependency management

### Installation

[](#installation)

```
   composer require fragotesac/zf1-2fa
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance45

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

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 ~9 days

Recently: every ~1 days

Total

7

Last Release

425d ago

Major Versions

0.0.1 → v1.12025-03-03

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1095778?v=4)[Francis Gonzales](/maintainers/FraGoTe)[@FraGoTe](https://github.com/FraGoTe)

---

Tags

frameworkZF1

### Embed Badge

![Health badge](/badges/fragotesac-zf1-2fa/health.svg)

```
[![Health](https://phpackages.com/badges/fragotesac-zf1-2fa/health.svg)](https://phpackages.com/packages/fragotesac-zf1-2fa)
```

PHPackages © 2026

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