Download the PHP package vormkracht10/filament-2fa without Composer

On this page you can find all versions of the php package vormkracht10/filament-2fa. 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 filament-2fa

Filament 2FA plugin

Two Factor Authentication for Laravel Filament

Latest Version on Packagist GitHub Tests Action Status PHPStan Total Downloads

This package adds Two Factor Authentication for your Laravel Filament app, using the first party package Laravel Fortify. We provide the views and logic to enable Two Factor Authentication (2FA) in your Filament app. Possible authentication methods are:

Features and screenshots

Enable Two Factor Authentication (2FA)

Enable Two Factor Authentication (2FA)

Using authenticator app as two factor method

Authenticator app

Using email or SMS as two factor method

Email or SMS

Recovery codes

Recovery codes

Two Factor authentication challenge

Two Factor challenge

Installation

You can install the package via composer:

If you don't have Laravel Fortify installed yet, you can install it by running the following commands:

You can then easily install the plugin by running the following command:

[!NOTE] If you used Laravel Fortify before, you probably already have users with 2FA enabled. In that case, you should let the install command set the default two_factor_type for existing users. Else you may run into issues.

Then add the plugin to your PanelProvider:

Make sure your user uses the TwoFactorAuthenticatable trait:

Also define the two_factor_type cast on your user model:

[!WARNING] When using fillable instead of guarded on your model, make sure to add two_factor_type to the $fillable array.

Also make sure to add the package files to your vite.config.js file:

Register the event listener

Laravel 11

In case you're using Laravel 11, you need to register the event listener in your AppServiceProvider boot method:

Laravel < 11

In case you're not using Laravel 11 yet, you will probably need to manually register the event listener in your EventServiceProvider:

If you want to customize the views (including email), you can publish them using the following command:

Usage

Configuration

The authentication methods can be configured in the config/filament-2fa.php file (which is published during the install command).

You can simply add or remove (comment) the methods you want to use:

If you want to use the SMS method, you need to provide an SMS service. You can check the Laravel Notifications documentation for ready-to-use services.

Example with Vonage

Like the example in the Laravel documentation you need to create the toVonage() method in your notification class. That's why we recommend creating a custom notification class that extends the original SendOTP class from this package:

You can get the two factor code for the user by calling the getTwoFactorCode method on the notification class.

Then you need to set the send_otp_class in the config/filament-2fa.php file:

[!NOTE] Make sure your user or notifiable model has a routeNotificationForVonage method that returns the phone number. Please check the documentation of the SMS service you're using for more information.

Customization

If you want to fully customize the pages, you can override the classes in the config/filament-2fa.php file:

Make sure you extend the original classes from the package.

Multi-tenant setup

If you're using Filament in a multi-tenant setup, you need to set the tenant option to true in the config/filament-2fa.php file. You also need to set the userMenuItems in your panel config. Take a look at the example below:

Forcing Two Factor Authentication

If you want to force users to enable Two Factor Authentication, you can add this to your PanelProvider:

[!WARNING] When you're using the forced method, make sure to set the multi_tenancy option to true in the filament-2fa.php config file when you're using a multi-tenant setup. Otherwise, the forced setting will not work. We cannot check the tenant in the PanelProvider because the user is not authenticated yet.

Customizing the forced message

If you want to customize the forced message, you can publish the language file:

Then you can customize the message in the lang/vendor/filament-2fa/en.json file. You should change the following keys:

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of filament-2fa with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
filament/filament Version ^3.0
filament/support Version ^3.2
laravel/fortify Version ^1.24
spatie/laravel-package-tools Version ^1.15.0
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 vormkracht10/filament-2fa contains the following files

Loading the files please wait ....