Google released two factor authentication for G-mail in 2011, to generate one time login tokens. By adding two factor authentication (2FA) to your web application will increases the security of your user's data. You need a smart phone to download "Authenticator" app to scan the QRCode generated after login or register.
How Google Authenticator works
Google Authenticator is a free app available for both Android and IOS smart phone. Authenticator generates a new code every 30 seconds. The process is as follows:
1. Your php application will generates a QR code that user scan with their phone camera to add the profile to their Google Authenticator app.
2. Then Authenticator app will generates a new code every 30 seconds to use for the second part of authentication to the application in php.
First we will create a registration form and a login form. After user register to the system we will generate the QRCode and validate through Google Authenticator App.
Google Two Factor Authentication