creativitykills/filament-pennant 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

creativitykills/filament-pennant

最新稳定版本:v0.0.3

Composer 安装命令:

composer require creativitykills/filament-pennant

包简介

Manage Feature Flags using Laravel Pennant from Filament.

README 文档

README

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

This plugin is heavily inspired by this plugin. There are several improvements including but not limited to:

Installation

You can install the package via composer:

composer require creativitykills/filament-pennant

You can publish and run the migrations with:

php artisan vendor:publish --tag="filament-pennant-migrations"
php artisan migrate

You can publish the config file with:

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

Usage

This package is exclusively for class based features.

You'll have to register the plugin in your panel provider.

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            FilamentPennantPlugin::make()
                ->authorize(fn () => auth()->user()->can('view.features'))
                // ...additional configuration available
                ->setNavigationGroup(__('Developer'))
                ->setNavigationLabel(__('Feature Segments'))
                ->setModelLabel(__('Feature Segments')),
        ]);
}

You don't have to call Feature::discover() in your service provider boot method, this package already does this for you. However, if you have your features in custom locations outside the App\Features directory, you need to register them using:

FilamentPennantServiceProvider::registerCustomFeatureLocations(['Modules\ACL\Features' => '/var/www/html/modules/ACL/Features']);

Create Class Based Feature

To create a class based feature, you may invoke the pennant:feature Artisan command.

php artisan pennant:feature WalletFunding

When writing a feature class, you only need to use the CK\FilamentPennant\Concerns\ResolvesFeatureSegments trait, which will be invoked to resolve the feature's initial value for a given scope.

<?php

namespace App\Features;

use Laravel\Pennant\Feature;
use Modules\Organization\Models\Organization;
use CK\FilamentPennant\Concerns\ResolvesFeatureSegments;

class RoleManagement
{
    use ResolvesFeatureSegments;

    // You can optionally specify the scope of the feature
    // public function scope(): string
    // {
    //     return User::class;
    // }
}

You can see the trait for more things you can override like the defaultValue property.

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.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-06-05