Weave 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

Larapost Laravel Package

websanova/larapost

Larapost is a Laravel package for quickly adding post and article management to your application, handling common backend pieces so you can focus on building and customizing the frontend. A simple starting point for blogs and content-driven sites.

View on GitHub
Deep Wiki
Context7

Getting Started

Larapost is a small, opinionated blog package: it ships models, migrations, admin CRUD screens, and front-end routes for posts (and usually categories/tags/comments). Treat it as a lightweight CMS you can stand up in an afternoon, then customize through published views and model subclassing rather than editing vendor/.

First, check compatibility before installing:

composer show websanova/larapost --all

Look at its composer.json constraints for laravel/framework and php. This package predates Laravel's package auto-discovery era, so assume you must register the service provider manually unless your installed version says otherwise.

Install and publish:

composer require websanova/larapost

# Laravel 5.4 and below: config/app.php
# Websanova\Larapost\LarapostServiceProvider::class

php artisan vendor:publish --provider="Websanova\Larapost\LarapostServiceProvider"
php artisan migrate

If vendor:publish prompts for tags, publish config, migrations, views, and assets separately:

php artisan vendor:publish --provider="Websanova\Larapost\LarapostServiceProvider" --tag=config
php artisan vendor:publish --provider="Websanova\Larapost\LarapostServiceProvider" --tag=views
php artisan vendor:publish --provider="Websanova\Larapost\LarapostServiceProvider" --tag=assets

Then discover the actual URLs:

php artisan route:list | grep -i -E 'blog|post|larapost'

Where to look first:

  • vendor/websanova/larapost/src/LarapostServiceProvider.php — what gets registered: routes, views, migrations, config, middleware.
  • src/Http/routes.php (or equivalent) — route prefixes, names, and middleware. This tells you whether the package exposes /blog, /admin/blog, or something else.
  • config/larapost.php — route prefix, middleware, model mappings, upload paths, pagination.
  • src/Models/ — Post, Category, Tag, Comment and their relationships/scopes.
  • resources/views/ — the Blade templates you will likely override.
  • database/migrations/ — table names and columns before you run them against an existing schema.

First use case: open the admin route, create a category, create a post with a title, slug, body, and published state, then view it on the front-end route. If the admin UI is not what you need, create content programmatically:

use Websanova\Larapost\Models\Post;
use Websanova\Larapost\Models\Category;

$category = Category::firstOrCreate(['name' => 'News']);

$post = Post::create([
    'title'        => 'Hello World',
    'slug'         => 'hello-world',
    'content'      => '<p>First post.</p>',
    'category_id'  => $category->id,
    'user_id'      => auth()->id(),
    'published_at' => now(),
]);

Confirm the actual fillable fields in the model before copying that snippet — older packages often use published booleans rather than published_at timestamps.

Implementation Patterns

Use the package as an admin CMS, not as your application architecture. Let authors create posts in Larapost's admin, but render them through your own controllers and views when you need control over layout, SEO, caching, or JSON APIs. The package models are ordinary Eloquent models, so you can query them anywhere:

$posts = Post::with(['category', 'tags', 'author'])
    ->where('published_at', '<=', now())
    ->latest('published_at')
    ->paginate(12);

Override views, don't edit vendor files. Publish views into resources/views/vendor/larapost/ and change the layout, pagination partial, or post card markup there. If the published views extend a package layout, point them at your application layout instead.

Extend models through subclassing when you need custom behavior. If the config exposes a model map, point it at your subclass; otherwise use your own model and query the same tables:

namespace App\Models;

use Websanova\Larapost\Models\Post as BasePost;

class Post extends BasePost
{
    protected $fillable = [
        'title', 'slug', 'content', 'category_id',
        'user_id', 'published_at', 'featured',
    ];

    public function scopePublished($query)
    {
        return $query->where('published_at', '<=', now());
    }

    public function getRouteKeyName()
    {
        return 'slug';
    }
}

If config/larapost.php supports a models array, wire it up:

'models' => [
    'post' => App\Models\Post::class,
],

Add custom fields with a normal migration. Add columns to the package's posts table, extend $fillable, then override the admin form view to expose the field. This is usually cleaner than forking the package.

Protect the admin routes explicitly. The package may only apply the web middleware group. Wrap its admin prefix with auth and an authorization gate:

// AppServiceProvider or a dedicated middleware
Gate::define('manage-blog', function ($user) {
    return $user->is_admin;
});

Then either configure the package's middleware in config/larapost.php or define your own route group that reuses the package controllers.

Disable or bypass front-end routes when integrating into an existing site. If the package's /blog routes conflict with your app, change the route prefix in config, or register your own routes and call the package models directly. Use php artisan route:list to see exactly what is registered before deciding.

Use Eloquent events for cross-cutting behavior. Slugs, excerpts, reading time, cache invalidation, and search indexing can be handled with saving/saved observers on the package models rather than editing vendor code.

For comments, build moderation into your workflow. If the package includes comments, expose only approved comments on the front-end, add spam protection (honeypot or reCAPTCHA), and consider closing comments entirely if the package's moderation tooling is thin.

Seed and import through models. For migrations from another blog, write an artisan command that maps old records to Post::create() calls. Use firstOrCreate on slugs to make imports idempotent.

Gotchas and Tips

  • This is an old, low-maintenance package. With 19 stars and a pre-modern Laravel lineage, expect missing Laravel 9+/10+ support. Check composer why-not websanova/larapost before assuming it will install. If you are on a modern Laravel version, plan to fork it into packages/larapost or reimplement the schema/models rather than fight Composer constraints.
  • Service provider registration is easy to forget. A 404 on every package route usually means the provider was never added to config/app.php (or auto-discovery is not supported).
  • Clear caches after any config or view change. php artisan config:clear, route:clear, and view:clear solve most "my changes aren't showing" problems.
  • Inspect migrations before running them. The package likely creates generic tables such as posts, categories, and tags. If your app already has a posts table, rename the package tables in the published migration or run it against a separate schema.
  • Admin routes may be unprotected. Never deploy without checking the middleware on the admin prefix. Add auth plus a gate; do not rely on obscure URLs for security.
  • Post body rendering is an XSS risk. Admin-authored HTML is usually rendered raw ({!! $post->content !!}). If non-trusted users can author posts, sanitize with HTMLPurifier or an equivalent before storage or output.
  • Slug collisions happen on update. Generate slugs with Str::slug() and enforce a unique index. Append -2, -3 suffixes on conflict, and exclude the current record when validating uniqueness.
  • Uploaded images often assume public/uploads or a public disk. Run php artisan storage:link if the package uses storage/app/public, and verify the path in config/larapost.php and the published views. Broken images are almost always a path or symlink issue.
  • Auth guard assumptions. The package may call auth()->user() or use the default web guard. If your app uses a custom guard or multi-auth setup, override the relevant controller/model behavior or set the guard in config.
  • Pagination markup may not match your CSS framework. The package's views likely target Bootstrap 3/4. Publish and replace the pagination partial, or call ->paginate() yourself in your own views.
  • Watch for N+1 queries. Always eager-load category, tags, and author relationships when listing posts.
  • Comments need spam handling. Package comment forms rarely include rate limiting or CAPTCHA. Add middleware, honeypots, or disable comments.
  • Route model binding may use IDs, not slugs. Override getRouteKeyName() in your subclass if you want /blog/hello-world URLs.
  • Configuration may be cached. If changes to config/larapost.php do nothing in production, run php artisan config:clear and redeploy.
  • No meaningful test suite is likely. Write feature tests around the routes and models you depend on, especially admin authorization and post visibility. Use RefreshDatabase and the package migrations so tests cover the real schema.
  • Fork deliberately if you need to upgrade. Because the package is small, copying its src/ and migrations into your app or a local path repository is often faster and safer than waiting for upstream compatibility. Once forked, you control the routes, middleware, and model behavior.
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.
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums
rlacerda83/query-parser
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings