定制 wychoong/filament-fortify 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

wychoong/filament-fortify

最新稳定版本:v0.3.4

Composer 安装命令:

composer require wychoong/filament-fortify

包简介

Laravel Fortify for Filament Admin

README 文档

README

Laravel Fortify for Filament Admin

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package provides the UI for using Fortify in Filament Admin Panel

Screenshots

Login

Screenshot of Login Screen

Register

Screenshot of Register Screen

Email Verification

Screenshot of Register Screen

Forgot Password

Screenshot of Forgot Password Screen

Two Factor Login

Screenshot of 2fa Login Screen

Two Factor Page

Screenshot of 2fa Page Screen

Password Confirmation

Screenshot of Password Confirmation Screen

Installation

You can install the package via composer:

composer require wychoong/filament-fortify

You can intallation command and run the migrations with:

php artisan filament-fortify:install 
php artisan migrate

The installation command does few things to speed up the installation process:

- Publish Fortify files
- Publish Fortify migration
- Add FortifyServiceProvider to config/app.php

As this package is only providing UI for Fortify, kindly refer Laravel Fortify documentation to setup, eg: User model.

Optional

You can publish filament-fortify config file with:

php artisan vendor:publish --tag="filament-fortify-config"

Optionally, you can publish the views using

php artisan vendor:publish --tag="filament-fortify-views"

Usage

This package respect the features configured in config/fortify.php, refer Laravel Fortify to enable/disable features.

To make the installation seemless, the following configs are overrided in the package.

config([
    ## override filament login page
    'filament.auth.pages.login' => Auth\Login::class,
    ## force fortify view enabled
    'fortify.views' => true,
    ## force fortify to use filament home_url
    'fortify.home' => config('filament.home_url'),
]);

Email Verification

Screenshot of Email Verification Screen

To allow user access only after email verified, enable the feature in config/fortify.php and update config/filament.php

'middleware' => [
    'auth' => [
        // ...
        'verified'
    ],
    // ...
]

## update your User model

use Illuminate\Contracts\Auth\MustVerifyEmail;

class User extends Authenticatable implements FilamentUser, MustVerifyEmail
{
    // ...
}

Password Confirmation

Screenshot of Password Confirmation Screen

To request user password confirmation before access a Page/Resource, add

protected static string | array $middlewares = ['password.confirm'];

to relevant Page/Resource.

2FA

Update your User model

use Laravel\Fortify\TwoFactorAuthenticatable;

class User extends Authenticatable implements FilamentUser
{
    // ...
    use TwoFactorAuthenticatable;
    // ...
}

A simple enable/disable user's 2fa page is included.

You can change the page's title, navigation group, navigation label in service provider:

use WyChoong\FilamentFortify\Facades\FilamentFortify;

public function boot()
{
    FilamentFortify::navigationGroup(__('your-nav-group'));
    FilamentFortify::navigationLabel(__('your-nav-label'));
    FilamentFortify::pageTitle(__('your-page-title'));
}

To disable it, publish the config file and set:

    'register-page' => false,

Customization

To use your own form, publish the config file and set your own livewire component

# config/filament-fortify.php
use App\Http\Livewire\Login;

return [
    // ...
    'auth' => [
        'login' =>  Login::class,
        // ...
    ],
    // ...
];

# app/Http/Livewire/Login.php
namespace App\Http\Livewire\Auth;

use WyChoong\FilamentFortify\Http\Livewire\Auth\Login as BaseLogin;

class Login extends BaseLogin{
    
    protected function getFormSchema(): array
    {
        return [
            // your form schema
        ];
    }
}

Theme

Depends on your project setup, you might register the css file with Filament::serving as per Filament Documentation, then you need to publish the fortify.config and add DispatchServingFilamentEvent::class to the middleware for Fortify's routes.

use Filament\Http\Middleware\DispatchServingFilamentEvent;

return [
    // ...
    'middleware' => ['web', DispatchServingFilamentEvent::class],
    //...
];

Render hooks

Make use of Filament's render hook to register additional content without publishing views.

Example with Filament-Socialite

## in Service Provider file
public function boot()
{
    Filament::registerRenderHook(
        'filament-fortify.login.end',
        fn (): string => Blade::render('@livewire(\'filament-socialite.buttons\')'),
    );
}

Screenshot of hook for socialite

Available hooks

  • filament-fortify.login.start
  • filament-fortify.login.end

Testing

composer test

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.

wychoong/filament-fortify 适用场景与选型建议

wychoong/filament-fortify 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 14.49k 次下载、GitHub Stars 达 33, 最近一次更新时间为 2022 年 03 月 02 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「laravel」 「wychoong」 「filament-fortify」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 wychoong/filament-fortify 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 wychoong/filament-fortify 我们能提供哪些服务?
定制开发 / 二次开发

基于 wychoong/filament-fortify 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 14.49k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 33
  • 点击次数: 22
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 33
  • Watchers: 2
  • Forks: 12
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-03-02