Download the PHP package jmrashed/two-factor-auth without Composer

On this page you can find all versions of the php package jmrashed/two-factor-auth. 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 two-factor-auth

Laravel Two-Factor Authentication (2FA)

Stable Version Total Downloads GitHub Stars GitHub Forks

Overview

The Laravel Two-Factor Authentication (2FA) package provides a seamless way to enhance the security of Laravel applications by implementing two-factor authentication for user authentication. With support for multiple authentication methods and customizable configuration options, this package offers developers a robust solution to protect user accounts against unauthorized access.

Key Features

Why Use Laravel 2FA

Getting Started

To get started with Laravel 2FA, simply install the package via Composer and follow the installation and configuration instructions provided in the documentation. With just a few simple steps, you can enhance the security of your Laravel applications and provide users with peace of mind knowing their accounts are well-protected.

Requirements

Ensure that your server environment meets the following requirements:

Before proceeding with the installation, verify that your server environment meets these requirements to ensure compatibility and smooth operation of the two-factor authentication package.

Installation

You can install the Laravel Two-Factor Authentication (2FA) package via Composer by running the following command in your terminal:

After installing the package, Laravel will automatically discover the service provider. If you're using Laravel version 5.5 or higher, the package will be auto-discovered. For older versions of Laravel, you may need to manually register the service provider in your config/app.php file:

How it Works

The Laravel Two-Factor Authentication (2FA) package introduces a flexible mechanism to enhance user authentication with an additional layer of security. Here's how it functions:

1. Contract Integration

The package seamlessly integrates a contract to determine whether a user, following successful credential validation, should employ Two-Factor Authentication (2FA) as a supplementary authentication measure.

2. Custom Views and Helper Functions

Included in the package are custom views and helper functions dedicated to managing Two-Factor Authentication (2FA) during login attempts. These resources facilitate the implementation of 2FA without the need for additional middleware or new guards. However, advanced users have the option to customize the authentication process manually if desired.

3. No Middleware Dependency

Unlike some alternatives, this package operates without a dependency on middleware. While it provides a simplified setup, it also allows users the flexibility to configure the authentication process according to their specific requirements, should they choose to do so manually.

4. Extensibility

The package is designed to be extensible, accommodating potential future enhancements and customizations. It offers a foundation upon which users can build additional features or integrate with other parts of their Laravel application.

Setup

Step - 01

Begin by installing the necessary components into your Laravel application, including migrations, translations, views, and configuration, using the following Artisan command:

Tip:

You can customize the migration before running it, such as adding new columns or changing the table name. Refer to the migration documentation for more details.

After installation, migrate the database tables using the standard Artisan migrate command:

Step - 02

Integrate the Two-Factor Authentication features into your User model or any other model where you want to enable Two-Factor Authentication. Simply add the TwoFactorAuthenticatable contract and the TwoFactorAuthentication trait to the model as shown below:

Tip:

The TwoFactorAuthenticatable contract identifies models using Two-Factor Authentication, while the TwoFactorAuthentication trait provides convenient methods for managing Two-Factor Authentication.

That's it! Your application is now equipped to utilize Two-Factor Authentication for enhanced security.

Enabling Two-Factor Authentication

To enable Two-Factor Authentication for a user, they must synchronize the Shared Secret between their Authenticator app and the application.

Tip:

Popular free Authenticator apps include iOS Authenticator, FreeOTP, Authy, and Google Authenticator, among others.

Start by generating the required data using the createTwoFactorAuth() method. This method returns a serializable Shared Secret that can be displayed to the user as a string or QR Code (encoded as SVG) in your view.

Next, the user must confirm the Shared Secret with a Code generated by their Authenticator app using the confirmTwoFactorAuth() method, which will automatically enable Two-Factor Authentication if the code is valid.

If the user doesn't provide the correct Code, the method will return false, prompting them to double-check their device's timezone or generate a new Shared Secret.

Recovery Codes

Recovery Codes, used as backup authentication methods, are automatically generated each time Two-Factor Authentication is enabled. By default, a collection of ten one-use 8-character codes is created.

You can retrieve these codes using the getRecoveryCodes() method.

Ensure you provide users with their Recovery Codes after enabling Two-Factor Authentication and advise them to securely store them. The generateRecoveryCodes() method can be used to generate a fresh batch of codes, replacing the previous set.

Important:

Users should be encouraged to generate new Recovery Codes if they deplete their current set or if they become inactive.

Logging In

For seamless user authentication, utilize the Auth2FA facade provided by the package, which handles the authentication process with support for Two-Factor Authentication.

Tip:

For Laravel UI or Laravel Breeze, refer to the package documentation for specific integration instructions.

In your Login Controller, employ the Auth2FA::attempt() method with the user's credentials. If Two-Factor Authentication is required, the user will be prompted to enter their 2FA Code.

This package enables TOTP authentication using 6 digits codes. No need for external APIs.

Authors

This package is maintained by jmrashed, a passionate developer dedicated to enhancing Laravel development experiences.

Feel free to contribute or report issues on GitHub. Your feedback and contributions are highly appreciated!

Contributing

We welcome contributions from everyone! Whether you're fixing a typo, adding a feature, or suggesting improvements, your contributions are valued and appreciated.

Follow these guidelines

If you're new to contributing to open-source projects, don't worry! Here's how you can get started:

  1. Fork the repository.
  2. Clone your forked repository to your local machine.
  3. Create a new branch for your changes.
  4. Make your changes and commit them with clear and descriptive messages.
  5. Push your changes to your forked repository.
  6. Submit a pull request to the main repository.

Code of Conduct

Please note that we have a Code of Conduct in place to ensure a welcoming and inclusive environment for everyone. By participating in this project, you agree to abide by its terms.

Feedback

Your feedback is crucial for the improvement of this package. If you encounter any issues, have ideas for new features, or simply want to share your thoughts, please open an issue on GitHub.

Thank you for your contributions! Together, we can make this package even better.

Documentation

Explore our comprehensive documentation to learn more about using the Two-Factor Authentication package:

Our documentation is continually updated to provide you with the latest information and best practices. If you have any questions or need further assistance, don't hesitate to reach out or open an issue on GitHub. We're here to help you succeed with your authentication needs.


All versions of two-factor-auth with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-json Version *
laragear/meta-model Version ^1.1
laragear/meta Version 3.*
bacon/bacon-qr-code Version 2.*
paragonie/constant_time_encoding Version ^2.6
illuminate/config Version 10.*|11.*
illuminate/validation Version 10.*|11.*
illuminate/database Version 10.*|11.*
illuminate/support Version 10.*|11.*
illuminate/http Version 10.*|11.*
illuminate/auth Version 10.*|11.*
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 jmrashed/two-factor-auth contains the following files

Loading the files please wait ....