PHPackages                             iamirnet/google-authenticator - 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. iamirnet/google-authenticator

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

iamirnet/google-authenticator
=============================

PHP SDK for Google Authenticator

1.0.0(3y ago)029Apache-2.0PHP

Since Jul 6Pushed 3y ago1 watchersCompare

[ Source](https://github.com/iamirnet/google-authenticator)[ Packagist](https://packagist.org/packages/iamirnet/google-authenticator)[ Docs](https://php.iamir.net/packages/google-authenticator)[ RSS](/packages/iamirnet-google-authenticator/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

[![Latest Version](https://camo.githubusercontent.com/86416a62280bd597d13ca2e6d3fe6a123d5d501deab931c4bff5a8e2391ba1a9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f69616d69726e65742f676f6f676c652d61757468656e74696361746f722e7376673f7374796c653d666c61742d737175617265)](https://github.com/iamirnet/google-authenticator/releases)[![GitHub last commit](https://camo.githubusercontent.com/e8fd044c489e6375cb08d6a74dedabad518c9d626065aa8c01266d6e6efc98a4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6173742d636f6d6d69742f69616d69726e65742f676f6f676c652d61757468656e74696361746f722e7376673f7374796c653d666c61742d737175617265)](#)[![Packagist Downloads](https://camo.githubusercontent.com/1f0abba7a0e9a1f104fb7db63a0af98d0ef3c2343512c8d37b1d1b99a53144f4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f69616d69726e65742f676f6f676c652d61757468656e74696361746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/iamirnet/google-authenticator)

Google Authenticator with PHP
=============================

[](#google-authenticator-with-php)

Google Authenticator generates 2-Step Verification codes on your phone.

2-Step Verification provides stronger security for your Google Account by requiring a second step of verification when you sign in. In addition to your password, you’ll also need a code generated by the Google Authenticator app on your phone.

Learn more about 2-Step Verification:

#### Installation

[](#installation)

```
composer require iamirnet/google-authenticator

```

 Click for help with installationInstall Composer
----------------

[](#install-composer)

If the above step didn't work, install composer and try again.

#### Debian / Ubuntu

[](#debian--ubuntu)

```
sudo apt-get install curl php-curl
curl -s http://getcomposer.org/installer | php
php composer.phar install

```

Composer not found? Use this command instead:

```
php composer.phar require "iamirnet/google-authenticator"

```

#### Installing on Windows

[](#installing-on-windows)

Download and install composer:

1.
2. Create a folder on your drive like C:\\iAmirNet\\GoogleAuthenticator
3. Run command prompt and type `cd C:\iAmirNet\GoogleAuthenticator`
4. `composer require iamirnet/google-authenticator`
5. Once complete copy the vendor folder into your project.

#### Getting started

[](#getting-started)

`composer require iamirnet/google-authenticator`

```
require 'vendor/autoload.php';
// config by specifying api key and secret
$ga = new \iAmirNet\GoogleAuthenticator\Authenticator("","");
```

=======

#### Create Secret Key

[](#create-secret-key)

```
/**
* Create a new random secret for the Google Authenticator app.
* 16 characters, randomly chosen from the allowed Base32 characters
* equals 10 bytes = 80 bits, as 256^10 = 32^16 = 2^80
*/
print_r($ga->create($issuer = null, $label = null, $width = 200, $height = 200));
```

 View Response```
Array
(
    'secret' => 'ILY3AYQEAPUZBUQM',
    'qr' => 'https://chart.googleapis.com/chart?chs=200x200&chld=M|0&cht=qr&chl=otpauth://totp/iAmirNet?secret=ILY3AYQEAPUZBUQM&issuer=iAmirNet'
)

```

#### Verify Code

[](#verify-code)

```
//Check the verification code entered by the user.
print_r($ga->verify($secret, $pin, $relaxed = 'enabled', $last = '')); // return false or time correct
```

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

[](#contribution)

- Give us a star ⭐
- Fork and Clone! Awesome
- Select existing [issues](https://github.com/iamirnet/google-authenticator/issues) or create a [new issue](https://github.com/iamirnet/google-authenticator/issues/new) and give us a PR with your bugfix or improvement after. We love it ❤️

Donate
------

[](#donate)

- USDT Or TRX: TUE8GiY4vmz831N65McwzZVbA9XEDaLinn 😘❤

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

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

Unknown

Total

1

Last Release

1411d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1670938?v=4)[Peyman Jahani](/maintainers/jahani)[@jahani](https://github.com/jahani)

---

Top Contributors

[![iamirnet](https://avatars.githubusercontent.com/u/68027783?v=4)](https://github.com/iamirnet "iamirnet (3 commits)")

---

Tags

google authenticatorgoogle.comPHP Google Authenticator

### Embed Badge

![Health badge](/badges/iamirnet-google-authenticator/health.svg)

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

###  Alternatives

[spomky-labs/otphp

A PHP library for generating one time passwords according to RFC 4226 (HOTP Algorithm) and the RFC 6238 (TOTP Algorithm) and compatible with Google Authenticator

1.5k46.1M119](/packages/spomky-labs-otphp)[scheb/2fa-google-authenticator

Extends scheb/2fa-bundle with two-factor authentication using Google Authenticator

298.2M30](/packages/scheb-2fa-google-authenticator)

PHPackages © 2026

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