iamirnet / google-authenticator
This package is abandoned and no longer maintained.
No replacement package was suggested.
PHP SDK for Google Authenticator
1.0.0
2022-07-06 19:07 UTC
README
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: https://g.co/2step
Installation
composer require iamirnet/google-authenticator
Click for help with installation
Install Composer
If the above step didn't work, install composer and try again.
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
Download and install composer:
- https://getcomposer.org/download/
- Create a folder on your drive like C:\iAmirNet\GoogleAuthenticator
- Run command prompt and type
cd C:\iAmirNet\GoogleAuthenticator
composer require iamirnet/google-authenticator
- Once complete copy the vendor folder into your project.
Getting started
composer require iamirnet/google-authenticator
require 'vendor/autoload.php'; // config by specifying api key and secret $ga = new \iAmirNet\GoogleAuthenticator\Authenticator("<issuer>","<label>");
=======
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
//Check the verification code entered by the user. print_r($ga->verify($secret, $pin, $relaxed = 'enabled', $last = '')); // return false or time correct
Contribution
- Give us a star ⭐
- Fork and Clone! Awesome
- Select existing issues or create a new issue and give us a PR with your bugfix or improvement after. We love it ❤️
Donate
- USDT Or TRX: TUE8GiY4vmz831N65McwzZVbA9XEDaLinn 😘❤