Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Filament Blog Laravel Package

firefly/filament-blog

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Steps to First Use Case

  1. Installation:

    composer require firefly/filament-blog
    php artisan filament-blog:install
    php artisan migrate
    php artisan storage:link
    
    • This publishes the config, migrations, and sets up the database tables with a default fblog_ prefix.
  2. Integrate with Filament Panel: Add the plugin to your Filament panel provider:

    public function panel(Panel $panel): Panel {
        return $panel->plugins([
            Blog::make(),
        ]);
    }
    
  3. First Blog Post:

    • Access the Filament admin panel (/admin).
    • Navigate to the Blog section (auto-generated by the plugin).
    • Create a new post using the Rich Editor (TinyMCE by default).
    • Publish immediately or schedule for later using the publish date field.
  4. View Live:

    • Visit /blogs (or your configured route prefix) to see the blog post in action.

Where to Look First

  • Config File: config/filamentblog.php – Customize routes, SEO, recaptcha, and table prefixes.
  • Filament Resources: The plugin auto-registers resources for Posts, Categories, and Comments in Filament.
  • Views: Published under resources/views/vendor/filament-blog (customize via vendor:publish).
  • Migrations: Check database/migrations/ for table structures (e.g., posts, categories).

First Use Case: Launch a Basic Blog

  1. Install and migrate.
  2. Create a post in Filament’s Blog > Posts resource.
  3. Set a title, body (using the WYSIWYG editor), and publish.
  4. Configure SEO meta tags in filamentblog.php under seo.meta.
  5. Test the live blog at /blogs.

Implementation Patterns

Core Workflows

1. Content Management Workflow

  • Create/Edit Posts: Use Filament’s Posts resource to draft, schedule, or publish posts. The editor supports:

    • Headings (H1–H6) for auto-generated Table of Contents (TOC).
    • Images (upload via Filament’s media library).
    • Custom HTML (if enabled in config).
    • Categories and tags (via relationships).
  • Workflow Example:

    graph LR
      A[Draft Post] -->|Save| B[Scheduled/Published]
      B -->|Edit| A
      B -->|Trash| C[Deleted]
    
  • Scheduled Posts: Set published_at in the future to auto-publish. The plugin handles this via Laravel’s queue system.

2. SEO Optimization

  • Dynamic Meta Tags: Override default SEO settings per post via Filament’s SEO Meta Extension:
    // In Post resource's EditForm
    use Firefly\FilamentBlog\Forms\Components\SEOMeta;
    
    SEOMeta::make()
        ->title('Custom Title')
        ->description('Custom description for this post.')
    
  • Sitemap Integration: Use Laravel’s sitemap package to include blog posts in XML sitemaps:
    Sitemap::add(Post::query()->where('published_at', '<=', now()));
    

3. User Engagement Features

  • Comments: Enable comments by:
    1. Publishing the comment form views:
      php artisan vendor:publish --tag=filament-blog-views
      
    2. Adding the comment partial to your post view:
      @include('filament-blog::comments.form')
      @include('filament-blog::comments.list')
      
    3. Configuring canComment() in your User model (see README).
  • Newsletter Subscriptions: Extend the plugin’s Subscribe component:
    use Firefly\FilamentBlog\Widgets\Subscribe;
    
    Subscribe::make()
        ->listener(function ($email) {
            // Add to Mailchimp/Newsletter service
        });
    

4. Multilingual Support

  • Use the norouzimohammadreza/multilingual package alongside Filament Blog:
    composer require norouzimohammadreza/multilingual
    
  • Configure locales in filamentblog.php:
    'locales' => ['en', 'es', 'fr'],
    
  • Translate post content via Filament’s localized fields.

5. Customizing the Frontend

  • Override Views: Publish and modify views:
    php artisan vendor:publish --tag=filament-blog-views
    
    Key files to customize:
    • resources/views/vendor/filament-blog/layouts/app.blade.php (main layout).
    • resources/views/vendor/filament-blog/posts/show.blade.php (single post).
  • Add Custom Fields: Extend the Post model or use Filament’s custom fields:
    use Filament\Forms\Components\Select;
    
    Select::make('custom_field')
        ->options(['option1', 'option2'])
        ->afterStateUpdated(fn ($state, $set) => $set('custom_field', $state));
    

6. API Integration (Headless CMS)

  • Expose blog data via Laravel API:
    Route::get('/api/posts', function () {
        return Post::with(['author', 'categories'])->get();
    });
    
  • Use Filament’s API Resources to structure responses:
    php artisan make:filament-resource Post --api
    

Integration Tips

With Filament Features

  • Media Library: Use Filament’s built-in media manager to upload post images:
    <x-filament-media-library-picker :model="$post" field="image" />
    
  • Notifications: Trigger Filament notifications for new posts:
    use Filament\Notifications\Notification;
    
    Notification::make()
        ->title('New Blog Post')
        ->body('Check out the latest post!')
        ->send();
    
  • Widgets: Add blog widgets to your Filament dashboard:
    use Firefly\FilamentBlog\Widgets\RecentPosts;
    
    RecentPosts::make()->height('300px');
    

With Third-Party Packages

  • Laravel Scout: Enable full-text search for posts:
    Post::addGlobalScope(new \Laravel\Scout\Builder);
    
  • Spatie Media Library: Integrate for advanced image handling:
    use Spatie\MediaLibrary\HasMedia;
    
    class Post extends Model implements HasMedia
    {
        use HasMedia;
    }
    
  • Laravel Echo/Pusher: Real-time updates for new posts/comments:
    Echo.channel('blog-updates')
        .listen('PostPublished', (e) => {
            // Update UI
        });
    

Gotchas and Tips

Pitfalls

  1. Table Prefix Conflicts:

    • If you change the tables.prefix in filamentblog.php after initial migration, run:
      php artisan filament-blog:upgrade-tables
      
    • Gotcha: Forgetting to back up the database before upgrading tables.
  2. Recaptcha Misconfiguration:

    • If recaptcha.enabled is true but keys are missing in .env, the comment form will fail silently.
    • Fix: Add to .env:
      RECAPTCHA_SITE_KEY=your_site_key
      RECAPTCHA_SECRET_KEY=your_secret_key
      
  3. Storage Permissions:

    • Uploaded post images may fail if storage:link isn’t run or permissions are incorrect.
    • Fix:
      chmod -R 775 storage/app/public
      php artisan storage:link
      
  4. Rich Editor Issues:

    • TinyMCE may not render if JavaScript assets aren’t published.
    • Fix: Publish views and clear cache:
      php artisan vendor:publish --tag=filament-blog-views
      php artisan optimize:clear
      
  5. SEO Meta Overrides:

    • Custom meta tags in filamentblog.php apply globally. To override per post, use Filament’s SEO Meta Extension in the resource.
  6. Comment Spam:

    • The plugin lacks built-in spam filtering (e.g., Akismet). Use a package like spatie/laravel-honeypot for protection.
  7. Filament Version Mismatch:

    • The package supports Filament 3.x and 5.x (as of v4.0.0). Mixing versions may break functionality.
    • Check: composer.json for Filament constraints.

Debug

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
ecotone/kafka
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata