定制 bensondevs/laravel-faq 二次开发

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

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

bensondevs/laravel-faq

最新稳定版本:v1.0.0-beta.1

Composer 安装命令:

composer require bensondevs/laravel-faq

包简介

A simple, flexible, and customizable FAQ management package for Laravel.

README 文档

README

A simple, flexible, and customizable FAQ management package for Laravel.
Built with tagging, sorting, and localization in mind.

Developed by Bensondevs

🚀 Features

  • Add FAQs with or without tags
  • Tag-based filtering
  • Multi-lingual question & answer support (via spatie/laravel-translatable)
  • Sortable (via spatie/eloquent-sortable)
  • API-ready with Resources
  • Easy integration into existing Laravel apps
  • Workbench support for local testing

📦 Installation

Require the package via Composer:

composer require bensondevs/laravel-faq

Publish config & migrations:

# Publish config file
php artisan vendor:publish --tag=faq-config

# Publish migrations file
php artisan vendor:publish --tag=faq-migrations

⚙️ Configuration

The default config file config/faq.php will be published. You can customize table names and other options there.

✅ Usage

Add a FAQ (no tag):

use Bensondevs\LaravelFaq\Faq;

$faq = Faq::add('What is Laravel?', 'Laravel is a PHP framework.');

Add a FAQ with a tag:

$faq = Faq::add(
    question: 'What is PHP?', 
    answer: 'A scripting language.', 
    locale: 'en', 
    tag: 'php',
);

Add with multiple tags:

$faq = Faq::add(
    question: 'What is Tailwind?', 
    answer: 'A CSS framework.', 
    locale: 'en', 
    tag: ['css', 'tailwind'],
);

Retrieve all FAQs:

Faq::all(); // returns FaqResource::collection

Retrieve by tag key or instance:

use Bensondevs\LaravelFaq\Models\Tag;

Faq::all('php');
Faq::all(Tag::first());
Faq::all(['php', 'laravel']);

🧪 Testing

This package uses Orchestra Testbench.

Run all tests:

./vendor/bin/phpunit

🎨 Code Style

This package uses Laravel Pint for formatting.

To auto-format your code:

./vendor/bin/pint

📄 License

This package is open-sourced software licensed under the MIT license.

🙌 Credits

统计信息

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

GitHub 信息

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

其他信息

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