Download the PHP package doge-dev/laravel-google-authenticator without Composer

On this page you can find all versions of the php package doge-dev/laravel-google-authenticator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-google-authenticator

laravel-google-authenticator

Google Authenticator implementation for Laravel

The package has a trait and a custom validation rule that you can use on any model for verifying the Google Authenticators code.

Table of contents

Installation

Pull the lib with composer:

Add the service provider in

You can add 2 Factor Verification to any model, and it will create:

Example

Add the trait to your User model (or any other model on which you might want to enable 2FA):

For MySQL databases you will need to add these attributes to your Model's migration:

Call the function on your model, and you're done. This will generate a secret for the given model.

You can add some helper attributes to your model, for the sake of convenience. We've also added and to the $visible attribute, tho this is not necessary either.

That's it! :) Now you can display the QR code to your user so that he can start using the Google Authenticator with your app.

Displaying the QR code

Now you can show the QR code to the user either with:

or

Verifying that the User set up Google Authenticator

You can check if the User successfully activated his 2FA:

When a User scans the QR Code, prompt him for the code and validate the User's 2FA:

For simple verification you can use:

Adding 2FA custom Validation

You can easily verify the code on any custom request by adding the validation:

The validator will try to validate the code using the logged in user (Auth::user()).

Adding 2FA custom Validation using route model binding

Or you can leverage route model binding and create a validation in your custom Request model:

In this case the validator expects to find an object in the route. The object needs to implement the above mentioned Trait in order for the validation to work.

Adding a custom name in Google Authenticator

You can set the text that is displayed in Google Authenticator by overriding the traits default getNameForQRCode() function in your Model implementation:


All versions of laravel-google-authenticator with dependencies

PHP Build Version
Package Version
Requires phpgangsta/googleauthenticator Version dev-master
guzzlehttp/guzzle Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package doge-dev/laravel-google-authenticator contains the following files

Loading the files please wait ....