{"id":17700531,"url":"https://github.com/stephenjude/filament-two-factor-authentication","last_synced_at":"2025-04-04T21:05:26.540Z","repository":{"id":254618983,"uuid":"842012112","full_name":"stephenjude/filament-two-factor-authentication","owner":"stephenjude","description":"Add two factor authentication (2FA) to Filament panels.","archived":false,"fork":false,"pushed_at":"2025-03-12T19:01:27.000Z","size":435,"stargazers_count":52,"open_issues_count":2,"forks_count":15,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-28T08:24:18.346Z","etag":null,"topics":["2fa","filamentphp","laravel","php","two-factor-authentication"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stephenjude.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"stephenjude"}},"created_at":"2024-08-13T13:48:28.000Z","updated_at":"2025-03-21T15:05:43.000Z","dependencies_parsed_at":"2024-11-13T11:31:53.129Z","dependency_job_id":"3241ec99-a12e-4843-8fd2-f8d264118c8e","html_url":"https://github.com/stephenjude/filament-two-factor-authentication","commit_stats":{"total_commits":35,"total_committers":6,"mean_commits":5.833333333333333,"dds":0.4571428571428572,"last_synced_commit":"b61cd712d4f3cc62f6cd9c2808d35007010e37c8"},"previous_names":["stephenjude/filament-two-factor-authentication"],"tags_count":22,"template":false,"template_full_name":"filamentphp/plugin-skeleton","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephenjude%2Ffilament-two-factor-authentication","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephenjude%2Ffilament-two-factor-authentication/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephenjude%2Ffilament-two-factor-authentication/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephenjude%2Ffilament-two-factor-authentication/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stephenjude","download_url":"https://codeload.github.com/stephenjude/filament-two-factor-authentication/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247249524,"owners_count":20908212,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["2fa","filamentphp","laravel","php","two-factor-authentication"],"created_at":"2024-10-24T17:42:28.659Z","updated_at":"2025-04-04T21:05:26.521Z","avatar_url":"https://github.com/stephenjude.png","language":"PHP","funding_links":["https://github.com/sponsors/stephenjude"],"categories":[],"sub_categories":[],"readme":"![Screenshot](https://raw.githubusercontent.com/stephenjude/filament-two-factor-authentication/main/art/banner.jpg)\n\n# Filament Two Factor Authentication (2FA)\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/stephenjude/filament-two-factor-authentication.svg?style=flat-square)](https://packagist.org/packages/stephenjude/filament-two-factor-authentication)\n[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/stephenjude/filament-two-factor-authentication/run-tests.yml?branch=main\u0026label=tests\u0026style=flat-square)](https://github.com/stephenjude/filament-two-factor-authentication/actions?query=workflow%3Arun-tests+branch%3Amain)\n[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/stephenjude/filament-two-factor-authentication/fix-php-code-style-issues.yml?branch=main\u0026label=code%20style\u0026style=flat-square)](https://github.com/stephenjude/filament-two-factor-authentication/actions?query=workflow%3A\"Fix+PHP+code+styling\"+branch%3Amain)\n[![Total Downloads](https://img.shields.io/packagist/dt/stephenjude/filament-two-factor-authentication.svg?style=flat-square)](https://packagist.org/packages/stephenjude/filament-two-factor-authentication)\n\nAdd two factor authentication to new and existing Filament applications.\n\n## Learn More\n[Filament Two-Factor Authentication Demo](https://www.youtube.com/watch?v=zLqKFsAmEaQ) — Filament Daily \n\n## Installation\n\nBelow, you'll find documentation on installing this plugin. If you have any questions, find a bug, need support, or have\na feature request, please don't hesitate to reach out to me at stephenjudesuccess@gmail.com.\n\nYou can install the package via composer:\n\n```bash\ncomposer require stephenjude/filament-two-factor-authentication\n```\n\nInstall the plugin migration using:\n```bash\nphp artisan filament-two-factor-authentication:install\n```\n\nOptionally, you can publish the views using\n```bash\nphp artisan vendor:publish --tag=\"filament-two-factor-authentication-views\"\n```\n\n## Model Configuration\nFirst, ensure that your application's authenticatio model uses the `TwoFactorAuthenticatable` trait:\n\n```php\nnamespace App\\Models;\n...\nuse Stephenjude\\FilamentTwoFactorAuthentication\\TwoFactorAuthenticatable;\n\nclass User extends Authenticatable implements FilamentUser\n{\n    ...\n    use TwoFactorAuthenticatable;\n```\n\n## Plugin Configuration\nAdd two factor authentication plugin to a panel by instantiating the plugin class and passing it to the plugin() method\nof the configuration:\n\n```php\n...\nuse Stephenjude\\FilamentTwoFactorAuthentication\\TwoFactorAuthenticationPlugin;\n \npublic function panel(Panel $panel): Panel\n{\n    return $panel\n        -\u003eplugins([\n            TwoFactorAuthenticationPlugin::make()\n                    -\u003eaddTwoFactorMenuItem() // Add 2FA settings to user menu items\n                    -\u003eenforceTwoFactorSetup() // Enforce 2FA setup for all users\n        ])\n}\n...\n```\n\n### Custom 2FA Settings Page\nIf your application already has a user profile page, you can add a 2FA settings to your profile page view:\n\n```php\n\u003cx-filament-panels::page\u003e\n    @livewire(\\Stephenjude\\FilamentTwoFactorAuthentication\\Livewire\\TwoFactorAuthentication::class)\n\u003c/x-filament-panels::page\u003e\n```\n## Events\nThis package dispatches events which your application can subscribe to. You can listen to these events inside your EventServiceProvider class:\n\n```php\nuse Stephenjude\\FilamentTwoFactorAuthentication\\Events\\{RecoveryCodeReplaced,RecoveryCodesGenerated,TwoFactorAuthenticationChallenged,TwoFactorAuthenticationConfirmed,TwoFactorAuthenticationDisabled,TwoFactorAuthenticationEnabled,TwoFactorAuthenticationFailed,ValidTwoFactorAuthenticationCodeProvided};\n\nprotected $listen = [\n    TwoFactorAuthenticationChallenged::class =\u003e [\n        // Dispatched when a user is required to enter 2FA code during login.\n    ],\n    TwoFactorAuthenticationFailed::class =\u003e [\n        // Dispatched when a user provides incorrect 2FA code or recovery code during login.\n    ],\n    ValidTwoFactorAuthenticationCodeProvided::class =\u003e [\n        // Dispatched when a user provides a valid 2FA code during login.\n    ]\n    TwoFactorAuthenticationConfirmed::class =\u003e [\n        // Dispatched when a user confirms code during 2FA setup.\n    ],\n    TwoFactorAuthenticationEnabled::class =\u003e [\n        // Dispatched when a user enables 2FA.\n    ],\n    TwoFactorAuthenticationDisabled::class =\u003e [\n        // Dispatched when a user disables 2FA.\n    ],\n    RecoveryCodeReplaced::class =\u003e [\n        // Dispatched after a user's recovery code is replaced.\n    ],\n    RecoveryCodesGenerated::class =\u003e [\n        // Dispatched after a user's recovery codes are generated.\n    ],\n];\n```\n\n## Screenshot\n![Screenshot](https://raw.githubusercontent.com/stephenjude/filament-two-factor-authentication/main/art/1.jpeg)\n#### 2FA Authentication\n\n![Screenshot](https://raw.githubusercontent.com/stephenjude/filament-two-factor-authentication/main/art/2.jpeg)\n#### 2FA Recovery\n\n![Screenshot](https://raw.githubusercontent.com/stephenjude/filament-two-factor-authentication/main/art/3.jpeg)\n#### 2FA Disabled\n\n![Screenshot](https://raw.githubusercontent.com/stephenjude/filament-two-factor-authentication/main/art/5.png)\n#### 2FA Setup \n\n![Screenshot](https://raw.githubusercontent.com/stephenjude/filament-two-factor-authentication/main/art/4.jpeg)\n#### 2FA Enabled (Recovery Codes)\n\n\n## Testing\n\n```bash\ncomposer test\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.\n\n## Security Vulnerabilities\n\nPlease review [our security policy](../../security/policy) on how to report security vulnerabilities.\n\n## Credits\n\n- [stephenjude](https://github.com/stephenjude)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephenjude%2Ffilament-two-factor-authentication","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstephenjude%2Ffilament-two-factor-authentication","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephenjude%2Ffilament-two-factor-authentication/lists"}