A Laravel package that provides the core backend logic for blogs, including post management, publishing workflows, slugs, tags, categories, and authoring. Frontend framework-agnostic and UI-independent.
joaoolival/laravel-blog-engine is a Laravel package for a laravel package that provides the core backend logic for blogs, including post management, publishing workflows, slugs, tags, categories, and authoring. frontend framework-agnostic and ui-independent..
It currently has 3 GitHub stars and 209 downloads on Packagist (latest version v1.1.0).
Install it with composer require joaoolival/laravel-blog-engine.
Discover more Laravel packages by joaoolival
or browse all Laravel packages to compare alternatives.
Last updated
A blog engine for Laravel with Filament admin panel integration. Manage posts, authors, and categories with automatic responsive image optimization.
composer require joaoolival/laravel-blog-engine
php artisan blog-engine:install
php artisan storage:link
Publish the configuration file to customize resource labels, navigation, and icons:
php artisan vendor:publish --tag="laravel-blog-engine-config"
You can customize the following for Posts, Authors, and Categories in config/laravel-blog-engine.php:
label & plural_label: Custom names for resources.navigation_label: Label shown in the sidebar.navigation_group: Group resources under a specific sidebar group (default: "Blog").navigation_sort: Order in the navigation.navigation_icon: Heroicon name (e.g., heroicon-o-pencil) for the sidebar icon.To restrict access to blog resources, simply create Policies for the models (BlogPost, BlogAuthor, BlogCategory). Filament will automatically detect and enforce them.
This allows you to define granular permissions for who can view, create, update, delete, and restore resources.
php artisan make:policy BlogPostPolicy --model=\Joaoolival\LaravelBlogEngine\Models\BlogPost
Then register them in your application's AuthServiceProvider (or AppServiceProvider in newer Laravel versions).
For more details, see the Filament Resource Authorization documentation.
use Joaoolival\LaravelBlogEngine\Facades\Blog;
$posts = Blog::getPublishedPosts(perPage: 12);
$post = Blog::getPostBySlug('my-post');
$authors = Blog::getAllAuthors();
$categories = Blog::getAllCategories();
Post content is stored as an HTML string (database longtext). When building APIs, use the provided HTTP Resources to automatically render content with responsive images:
use Joaoolival\LaravelBlogEngine\Http\Resources\Posts\BlogPostResource;
return new BlogPostResource($post);
The resource transforms the content HTML, finding image tags with data-id and replacing them with:
srcset attributes for responsive loadingNote: Accessing
$post->contentdirectly returns the raw HTML with custom attributes. UseBlogPostResourcefor fully rendered HTML with responsive images.
| Method | Description |
| --------------------------------------------------- | ----------------------------------------- |
| getPublishedPosts(?int $perPage) | Published posts (paginated or collection) |
| getPostBySlug(string $slug) | Single post by slug |
| getRecentPosts(int $limit = 5) | Most recent posts (for sidebars) |
| getRelatedPosts(BlogPost $post, int $limit = 4) | Related posts by category/tags |
| searchPosts(string $query, ?int $perPage) | Search posts by title/excerpt/content |
| getAllAuthors() | All visible authors |
| getAuthorWithPosts(string $slug, ?int $perPage) | Author with their posts |
| getAllCategories() | All visible categories |
| getCategoryWithPosts(string $slug, ?int $perPage) | Category with its posts |
| Attribute | Type | Description |
| -------------- | ---------------- | ----------------------- |
| title | string | Post title |
| slug | string | URL-friendly identifier |
| excerpt | string \| null | Short summary |
| content | string \| null | HTML content (longtext) |
| tags | array \| null | Post tags |
| is_visible | bool | Visibility flag |
| published_at | Carbon \| null | Publish date |
Scopes:
BlogPost::whereIsPublished()->get();
BlogPost::whereIsDraft()->get();
BlogPost::whereIsVisible()->get();
| Attribute | Type |
| ---------------------------------------- | -------------- |
| name, slug, email | string |
| bio, github_handle, twitter_handle | string\|null |
| Attribute | Type |
| --------------------------------------------- | -------------- |
| name, slug | string |
| description, seo_title, seo_description | string\|null |
| is_visible | bool |
Access the Filament admin at /admin:
/admin/blog-posts/admin/blog-authors/admin/blog-categoriesThis package uses Spatie Media Library for image handling. Images are automatically converted to WebP with responsive variants.
For background processing, install Laravel Horizon:
composer require laravel/horizon
php artisan horizon:install
php artisan horizon
Quickly populate your blog with dummy content using the blog:generate command:
php artisan blog:generate
This will prompt for the number of authors, categories, and posts to create (defaults: 1, 1, 12).
You can also pass options directly:
php artisan blog:generate --authors=3 --categories=5 --posts=50
composer test
If you encounter any issues or have questions, please open an issue on GitHub.
MIT. See LICENSE.md.