laravel-faq maintained by bensondevs
Description
A simple, flexible, and customizable FAQ management package for Laravel.
Author
Last update
2025/06/13 12:48
(dev-main)
License
Downloads
24
Tags
Laravel FAQ 📚
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
- Simeon Bensona
- Spatie for translatable & sortable packages
- Laravel community