bambolee-digital/onboarding-package 问题修复 & 功能扩展

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

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

bambolee-digital/onboarding-package

Composer 安装命令:

composer require bambolee-digital/onboarding-package

包简介

Laravel/FilamentPHP package for managing customizable onboarding flows.

README 文档

README

OnboardingPackage is a Laravel package that allows you to create customized onboarding flows for users, including dynamic questions, options, conditional messages, and flow control based on user responses. The package supports multiple languages using Spatie Laravel Translatable and integrates with the FilamentPHP admin panel for easy management.

Table of Contents

Installation

You can install the package via Composer:

composer require bamboleedigital/onboarding-package

After installation, publish the migration and configuration files:

php artisan vendor:publish --provider="BamboleeDigital\OnboardingPackage\Providers\OnboardingServiceProvider" --tag="migrations"
php artisan vendor:publish --provider="BamboleeDigital\OnboardingPackage\Providers\OnboardingServiceProvider" --tag="config"

Then, run the migrations:

php artisan migrate

Configuration

Filament and Spatie Laravel Translatable

Make sure that FilamentPHP and Spatie Laravel Translatable are installed and configured in your project.

Install the Filament translation plugin:

composer require filament/spatie-laravel-translatable-plugin:"^3.2" -W

Add the plugin to your Filament panel:

use Filament\SpatieLaravelTranslatablePlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->plugin(
            SpatieLaravelTranslatablePlugin::make()
                ->defaultLocales(['en', 'pt']), // Set the languages you want to support
        );
}

Package Configuration

The package configuration file allows you to customize options as needed. The config/onboarding-package.php file will be published in the root of your project's config folder.

Usage

Managing Questions and Options

Access the FilamentPHP admin panel and navigate to the Questions menu.

Create a New Question

  1. Click on Create.
  2. Enter the Question Text. Use the LocaleSwitcher to add translations in different languages.
  3. Select the Question Type:
    • Text: The user will provide a free-text answer.
    • Single Choice: The user will select one option.
    • Multiple Choice: The user can select multiple options.
  4. Save the question.

Manage Options

For Single Choice or Multiple Choice questions:

  1. Within the created question, access the Options tab.
  2. Click Create to add a new option.
  3. Enter the Option Text and translations, if applicable.
  4. Optionally, add a Conditional Message in Markdown. This message will be displayed to the user if this option is selected.
  5. Set the Next Question if you want to control the flow based on the user's response.
  6. Save the option.

Defining Conditional Messages

Conditional messages are directly associated with options. When adding a conditional message to an option, it will be displayed to the user when that option is selected.

Controlling the Question Flow

You can define the next question the user will see after selecting a particular option:

  1. In the option creation or editing form, select the Next Question in the corresponding field.
  2. If no next question is defined, the system will follow the default order.

API Endpoints

Submit User Response

URL: /api/onboarding/responses

Method: POST

Parameters:

  • question_id (integer, required): ID of the answered question.
  • response_id (integer, optional): ID of the selected option (for choice questions).
  • response (string, optional): User's response (for text questions).

Request Example:

POST /api/onboarding/responses
Content-Type: application/json

{
  "question_id": 1,
  "response_id": 5,
  "user_id": 123
}

Response Example:

{
  "next_question": {
    "id": 2,
    "text": "What is your age?",
    "type": "text",
    "options": []
  },
  "conditional_message": {
    "message": "Thank you for choosing this option. Here's a personalized message."
  }
}

Get User Responses

URL: /api/onboarding/user-responses

Method: GET

Parameters:

  • user_id (integer, required): User ID.

Request Example:

GET /api/onboarding/user-responses?user_id=123

Response Example:

{
  "responses": [
    {
      "question_id": 1,
      "question_text": "What is your name?",
      "response": "John",
      "response_id": null,
      "option_text": null
    },
    {
      "question_id": 2,
      "question_text": "What is your favorite color?",
      "response": null,
      "response_id": 5,
      "option_text": "Blue"
    }
    // Other responses...
  ]
}

Usage Examples

Basic Onboarding Flow

  1. The user starts the onboarding process.
  2. The application consumes the endpoint to send the user's responses.
  3. The backend returns the next question and any conditional messages.
  4. The frontend displays the question and processes the user's response.
  5. The flow continues until there are no more questions.

Displaying Conditional Messages

  • When the user selects an option with a conditional message, that message is returned in the API response and can be displayed immediately.

Controlling the Flow Based on Responses

  • By setting the Next Question on an option, you can direct the user to different paths in the onboarding flow, creating personalized experiences.

License

The OnboardingPackage is licensed under the MIT license.

bambolee-digital/onboarding-package 适用场景与选型建议

bambolee-digital/onboarding-package 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 24 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 09 月 14 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 bambolee-digital/onboarding-package 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-09-14