bensondevs / laravel-faq
A simple, flexible, and customizable FAQ management package for Laravel.
v1.0.0-beta.1
2025-06-13 10:48 UTC
Requires
- php: >=8.2
- spatie/eloquent-sortable: ^4.5
- spatie/laravel-translatable: ^6.11
Requires (Dev)
- laravel/pint: ^1.22
- orchestra/testbench: ^10.4
- pestphp/pest: ^3.8
This package is auto-updated.
Last update: 2025-06-13 10:55:39 UTC
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
- Simeon Bensona
- Spatie for translatable & sortable packages
- Laravel community