fuelviews/laravel-sabhero-blog

v0.0.8 2025-05-10 17:47 UTC

README

Latest Version on Packagist Total Downloads

A full-featured blog management solution for Laravel applications with Filament admin panel integration. This package provides a complete blogging platform with advanced features and an intuitive admin interface.

Features

  • Complete Blog Management: Posts, categories, tags, and authors
  • Scheduled Publishing: Schedule posts to be published automatically
  • Blade Components: Ready-to-use UI components including cards, feature cards, and breadcrumbs
  • Advanced Content: Markdown rendering with automatic table of contents
  • Media Management: Image uploads with responsive images support
  • SEO Optimization: Built-in SEO meta data for better search rankings
  • RSS Feed: Automatic feed generation with customizable settings
  • Tailwind Pagination: Custom pagination views for Tailwind CSS
  • Filament Integration: Full admin panel for managing all blog content

Installation

Prerequisites

This package requires Filament. If your project doesn't have Filament yet:

composer require filament/filament:"^3.2" -W
php artisan filament:install --panels

Create a Filament User

php artisan make:filament-user

Install the SabHero Blog Package

composer require fuelviews/laravel-sabhero-blog

Configuration

1. Publish Configuration Files

php artisan vendor:publish --tag="sabhero-blog-config"

2. Publish Migrations

php artisan vendor:publish --tag="sabhero-blog-migrations"

3. Run Migrations

php artisan migrate

Integration

1. Attach to Filament Panel

Add the SabHero Blog plugin to your Filament panel provider:

use Fuelviews\SabHeroBlog\Facades\SabHeroBlog;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            SabHeroBlog::make()
        ]);
}

2. Add Traits and CanAccessPanel to User Model

Your user model needs to bet setup to use HasBlog and HasAuthor traits, don't forget setting CanAccessPanel:

use Filament\Models\Contracts\FilamentUser;
use Filament\Models\Contracts\HasAvatar;
use Filament\Panel;
use Fuelviews\SabHeroBlog\Traits\HasAuthor;
use Fuelviews\SabHeroBlog\Traits\HasBlog;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;

class User extends Authenticatable implements FilamentUser, HasAvatar
{
    use HasFactory, Notifiable, HasBlog, HasAuthor;
    
    public function canAccessPanel(Panel $panel): bool
    {
        $allowedDomains = ['@fuelviews.com', 'admin.com'];

        foreach ($allowedDomains as $domain) {
            if (str_ends_with($this->email, $domain)) {
                return true;
            }
        }

        return false;
    }
}

RSS Feed

The package automatically generates an RSS feed available at /blog/rss. To customize feed settings:

php artisan vendor:publish --tag="sabhero-blog-feed-config"

Available Components

SabHero Blog comes with several Blade components for easy UI implementation:

  • <x-sabhero-blog::layout> - Main blog layout
  • <x-sabhero-blog::card> - Blog post card
  • <x-sabhero-blog::feature-card> - Featured post card
  • <x-sabhero-blog::breadcrumb> - Breadcrumb navigation
  • <x-sabhero-blog::header-category> - Category header
  • <x-sabhero-blog::header-metro> - Metro-style header
  • <x-sabhero-blog::markdown> - Markdown content renderer
  • <x-sabhero-blog::recent-post> - Recent posts display

Testing

composer test

Changelog

Please see CHANGELOG for more information on recent changes.

Contributing

Please see CONTRIBUTING for contribution guidelines.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.