定制 clearlyip/laravel-flagsmith 二次开发

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

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

clearlyip/laravel-flagsmith

最新稳定版本:3.2.0

Composer 安装命令:

composer require clearlyip/laravel-flagsmith

包简介

A Flagsmith client for Laravel

README 文档

README

Laravel-flagsmith was created by, and is maintained by Andrew Nagy, the package is designed to allow Laravel to work with Flagsmith

Total Downloads Latest Stable Version License

Features

Installation & Usage

Requires PHP 8.2+

Require Laravel-flagsmith using Composer:

composer require clearlyip/laravel-flagsmith

Laravel Version Compatibility

Laravel Laravel Flagsmith
8.x 1.x
9.x 2.x
10.x 3.x

Usage

Configuration Files

  • Publish the Laravel Flagsmith configuration file using the vendor:publish Artisan command. The flagsmith configuration file will be placed in your config directory (Use --force to overwrite your existing clearly config file):
    • php artisan vendor:publish --tag="flagsmith" [--force]

All options are fully documented in the configuration file

User

It's advised to add the interface Clearlyip\LaravelFlagsmith\Contracts\UserFlags to your user model. This will give you the ability to access flags directly from your user object.

You can add the following trait Clearlyip\LaravelFlagsmith\Concerns\HasFlagss to your user model to fulfill the requirements of UserFlags

During initial login user flags are synced through a queue which keeps them as up to date as possible

Get All Flags for a User

$user = Auth::user();
$flags = $user->getFlags();

Check if flag is enabled for a user

An optional second parameter can be added as the default if the flag does not exist

$user = Auth::user();
$flags = $user->isFlagEnabled('foo');

Get a Flag value for a User

An optional second parameter can be added as the default if the flag does not exist

$user = Auth::user();
$vakue = $user->getFlagValue('foo');

Accessing

The Flagsmith Class can be accessed through Laravel's Container. The returned class is simply flagsmith-php-client

$flagsmith = App::make(Flagsmith::class);

统计信息

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

GitHub 信息

  • Stars: 6
  • Watchers: 6
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2021-10-21