The Guide package provides a comprehensive FAQ and knowledge base system for the Anchor Framework. It features hierarchical categories, rich media support, full-text search, and helpfulness analytics.
- Hierarchical Categories: Organize articles into nested categories.
- Rich Media: Attach images and videos to help articles.
- Full-text Search: Find articles quickly with built-in search analytics.
- Helpfulness Feedback: Collect user ratings and comments on articles.
- Automatic Audit: Logs article views and management actions.
Guide is a package that requires installation before use.
php dock package:install Guide --packagesThis command will:
- Publish the
guide.phpconfiguration file. - Run the migration for Guide tables.
- Register the
GuideServiceProvider.
use Guide\Guide;
// Create a parent category
$billing = Guide::category()
->name('Billing & Payments')
->description('Everything related to your invoices and plans.')
->create();
// Create a sub-category
Guide::category()
->name('Refunds')
->parent($billing)
->create();// Find by slug
$category = Guide::findCategory('billing-payments');
// Find by refid
$category = Guide::findCategoryByRefId('cat_abcdef123');// Create a published article
$article = Guide::article()
->title('How to Update Your Card')
->content('Go to Settings > Billing and click "Update Card"...')
->category($billing)
->status('published')
->create();// Find by slug
$article = Guide::findArticle('how-to-update-your-card');
// Find by refid
$article = Guide::findArticleByRefId('art_xyz789');$results = Guide::search('payment');
foreach ($results as $article) {
echo $article->title;
}$results = Guide::search('refund', [
'category' => $billing->id
], [
'ip' => request()->ip(),
'user_agent' => request()->header('User-Agent')
]);Guide::analytics()->recordView($article);Guide::analytics()->submitFeedback(
$article,
rating: 5,
comment: 'Very helpful!'
);// Returns: [[Article Model], [Article Model], ...]
$popular = Guide::analytics()->getPopularArticles(limit: 5);The Guide::analytics() service provides insights into how users interact with your help center.
| Property | Type | Description |
|---|---|---|
query |
string |
The search term entered by the user. |
results_count |
int |
Number of articles found for this query. |
ip_address |
string |
The IP address of the user. |
metadata |
json |
Browser and session data. |
| Property | Type | Description |
|---|---|---|
guide_article_id |
int |
The ID of the rated article. |
rating |
int |
Rating value (typically 1-5). |
comment |
string |
Optional user feedback. |
You can link related articles to help users discover more content.
Guide::relateArticles($article, $anotherArticle);Standardize how media is attached to articles for consistent rendering.
// Attach as a main featured image
Guide::attachMedia($article, $mediaId, type: 'featured');
// Attach as a downloadable resource
Guide::attachMedia($article, $mediaId, type: 'attachment');Standard Eloquent scopes for common queries:
use Guide\Models\Article;
// Get all published articles
$articles = Article::published()->get();
// Get most viewed articles
$popular = Article::orderBy('view_count', 'desc')->limit(10)->get();// Assuming $mediaId from Media package
Guide::attachMedia($article, $mediaId, type: 'featured');Guide::relateArticles($article, $anotherArticle);Configuration is located in App/Config/guide.php:
return [
'search' => [
'limit' => 10,
'log_enabled' => true,
],
'feedback' => [
'enabled' => true,
],
];