定制 explicitdev/laravel-ab-testing 二次开发

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

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

explicitdev/laravel-ab-testing

最新稳定版本:v1.4.1

Composer 安装命令:

composer require explicitdev/laravel-ab-testing

包简介

Run Laravel-native A/B tests with sticky assignment, conversion tracking, and result summaries.

README 文档

README

Pipeline Status License: MIT Laravel

Laravel-native experimentation for apps that need more than feature flags.

Laravel A/B Testing is a Laravel-native experimentation package for teams that want more than feature flags. It is designed to help you define experiments as code, assign sticky variants to real Laravel subjects, track conversions, and review trustworthy results without bolting a generic external platform onto your app.

composer require explicitdev/laravel-ab-testing
php artisan vendor:publish --tag=ab-testing-config
php artisan migrate

Features

  • Experiments defined in PHP or config
  • Sticky variant assignment for Eloquent models and custom subject keys
  • Explicit guest-to-user merge helpers for session-backed experiments
  • Even and weighted traffic splits
  • Primary and secondary goals
  • Conversion tracking with deduplication
  • Targeting rules
  • Experiment lifecycle states: draft, running, paused, concluded
  • Result summaries with frequentist significance reporting
  • Subject-type segment filters and multi-segment result breakdowns
  • Export-friendly JSON and CSV reporting from the results command
  • Configurable cached result summaries with a fresh-bypass path for operators
  • Structured result alerts with a dedicated Artisan alert view
  • Blade directives, events, and Artisan commands
  • A full automated test suite with 100% source coverage

Quick Example

Define an experiment in a service provider:

use ExplicitDev\AbTesting\Facades\AB;

AB::experiment('checkout_cta')
    ->description('Compare checkout button copy for paid plan users.')
    ->variants(['pay-now', 'complete-order'])
    ->labels([
        'pay-now' => 'Pay Now',
        'complete-order' => 'Complete Order',
    ])
    ->goal('checkout_completed')
    ->splitEvenly()
    ->targeting(fn ($user) => $user->plan === 'paid');

Assign a variant in your application:

$variant = AB::for($user)->variant('checkout_cta');

if ($variant->is('pay-now')) {
    $buttonText = 'Pay Now';
} else {
    $buttonText = 'Complete Order';
}

Track a conversion when the goal happens:

AB::for($user)->convert('checkout_cta');

Inspect results:

$results = AB::results('checkout_cta');

Segment-aware result slices stay in the same API:

use ExplicitDev\AbTesting\Results\ResultSegment;

$guestResults = AB::results(
    'checkout_cta',
    segment: ResultSegment::subjectType('session', 'Guest Sessions'),
);

$merge = AB::forSubject('session:'.$sessionKey, 'session')->mergeInto($user);
$freshRows = AB::results('checkout_cta', fresh: true)->rows();
$alerts = AB::results('checkout_cta')->alerts();

Why This Package Exists

Laravel Pennant is excellent for feature flags and controlled rollouts, but it is not a full experiment system. A real experiment package needs:

  • sticky assignment
  • goal tracking
  • conversion deduplication
  • experiment lifecycle controls
  • result summaries with clear statistical framing
  • Laravel-native ergonomics across Blade, Eloquent, events, queues, and Artisan

The package focuses on self-hosted experimentation workflows for Laravel teams.

Current Non-Goals

The package does not try to solve every experimentation problem:

  • Bayesian reporting
  • sequential testing
  • multivariate testing
  • automatic cross-device guest identity resolution
  • full funnel definitions
  • hosted SaaS control plane
  • drag-and-drop experiment builder

Those can come later without complicating the core package.

Documentation

Start with the documentation index:

Public docs for the full package family, including the paid add-ons, are mirrored in explicitdev/laravel-ab-testing-docs.

If you use the commercial add-ons, set the shared family-level license key once through AB_TESTING_LICENSE_KEY. The paid packages all use that same key.

Commercial Add-Ons

The MIT core covers the fundamentals. Paid add-ons can focus on business visibility and operator workflows:

  • explicitdev/laravel-ab-testing-filament for Filament dashboards, lifecycle actions, segment analysis, exports, and audit history
  • explicitdev/laravel-ab-testing-ui for Blade-first read-only reporting inside internal tools, support consoles, customer portals, and other custom app pages
  • explicitdev/laravel-ab-testing-nova for Nova dashboards, resources, and lifecycle actions
  • explicitdev/laravel-ab-testing-blade-admin for framework-light Blade admin dashboards, exports, and lifecycle actions without Filament or Nova
  • explicitdev/laravel-ab-testing-backpack for Backpack dashboards, detail pages, exports, and lifecycle actions
  • future premium layers for advanced statistics, alert routing, and broader team workflows once the current add-ons have more time in production

Commercial add-ons are sold through Explicit Development at https://explicitdev.com/packages.

Support

Open bugs, install questions, documentation gaps, and feature requests in:

See SUPPORT.md for the preferred support workflow and the details that make triage faster.

Testing The Package

composer test
composer analyse
composer format:test
composer test:coverage

Contributing

Please read CONTRIBUTING.md before opening a support issue or a forked merge request.

Security

Please review SECURITY.md for supported versions and vulnerability reporting.

Guiding Principle

The package aims to stay easier, clearer, and more Laravel-native than wiring a generic experimentation tool into a Laravel app.

License

Laravel A/B Testing is open-sourced software licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固