PHPackages                             bjuppa/laravel-blog - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. bjuppa/laravel-blog

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

bjuppa/laravel-blog
===================

Add blog functionality to your Laravel project

v1.11.2(3mo ago)483.4k↓92.6%61MITPHPPHP ^8.2CI passing

Since Jul 4Pushed 3mo ago5 watchersCompare

[ Source](https://github.com/bjuppa/laravel-blog)[ Packagist](https://packagist.org/packages/bjuppa/laravel-blog)[ Docs](https://github.com/bjuppa/laravel-blog)[ RSS](/packages/bjuppa-laravel-blog/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (28)Versions (47)Used By (1)

laravel-blog
============

[](#laravel-blog)

This package is a flexible blogging solution that you can add to your [Laravel](https://laravel.com) app.

Is takes blog entries from *storage* and publishes them to [the Web](https://en.wikipedia.org/wiki/World_Wide_Web)in common formats for consumption by people and machines through URLs.

Each blog gets:

- An index page listing the latest entries
- A page for each blog entry displaying its full contents
- An [Atom feed](https://en.wikipedia.org/wiki/Atom_(standard))

The default storage is [Eloquent](https://laravel.com/docs/eloquent), but you may create your own `BlogEntryProvider` should you wish. Have a look at the files in [`src/Contracts`](https://github.com/bjuppa/laravel-blog/tree/master/src/Contracts)for a quick overview of the entites this package handles.

Admin interface
---------------

[](#admin-interface)

This package **does not** provide any admin interface for editing blog entries. There's a [separate package](https://packagist.org/packages/bjuppa/laravel-blog-admin)that can *optionally* be installed to provide admin routes for editing blog contents.

Another option is to create the mechanism to edit blog entries yourself, in your Laravel app. [Entries](https://github.com/bjuppa/laravel-blog/blob/master/src/Eloquent/BlogEntry.php)are represented by [Eloquent models](https://laravel.com/docs/eloquent)by default, so shouldn't be too hard for Laravel developers.

Requirements
------------

[](#requirements)

You need at least **Laravel 7** to use this package. The included [entry model](https://github.com/bjuppa/laravel-blog/blob/master/src/Eloquent/BlogEntry.php)and [migration](https://github.com/bjuppa/laravel-blog/blob/master/database/migrations/2017_10_04_000000_create_blog_entries_table.php)requires a database connection supporting json-type columns.

Usage
-----

[](#usage)

1. Require the package:

    ```
    composer require bjuppa/laravel-blog
    ```

    The package will automatically register itself.
2. Publish the configuration file:

    ```
    php artisan vendor:publish --provider="Bjuppa\LaravelBlog\BlogServiceProvider" --tag="blog-config"
    ```
3. Edit the published configuration file `config/blog.php`to setup your desired blogs and their options.

    Configurations may be changed later and more blogs can be added etc. Just remember that permalinks and generated entry IDs should ideally be kept constant after a blog has been published to avoid broken feeds and links for your audience.

    The service provider handles registration of routes to all configured blogs. You can check which routes and paths are generated using:

    ```
    php artisan route:list
    ```
4. Run migrations to automatically set up any tables needed to use the configured blog entry providers:

    ```
    php artisan migrate
    ```
5. (optional) If you want to create a default blog entry in the database you can run the seeder:

    ```
    php artisan db:seed --class="Bjuppa\LaravelBlog\Database\Seeds\DefaultBlogEntrySeeder"
    ```
6. (optional) If you want to use the included styling, first publish the CSS to your public directory:

    ```
    php artisan vendor:publish --provider="Bjuppa\LaravelBlog\BlogServiceProvider" --tag="blog-styling"
    ```

    ...then edit `config/blog.php` and add `'css/blog.css'`to the `stylesheets` config.

Now visit your fresh blog in a browser! The default url path is `/blog` unless you've changed the config.

Edit blog posts
---------------

[](#edit-blog-posts)

Add and edit blog entries in the database any way you like. You can create your own admin interface, write straight to the database, or perhaps use [`php artisan tinker`](https://laravel.com/docs/artisan#introduction)... 😉 The model used by default is [`Bjuppa\LaravelBlog\Eloquent\BlogEntry`](https://github.com/bjuppa/laravel-blog/blob/master/src/Eloquent/BlogEntry.php).

There is [a separate package providing an admin interface](#admin-interface).

### User permissions

[](#user-permissions)

All published entries are public to *view* by anyone at their url.

To enable users to *preview* unpublished entries, first create a Laravel [gate](https://laravel.com/docs/authorization#gates) or [policy](https://laravel.com/docs/authorization#creating-policies)(for your entry model) and then configure the `preview_ability` in your `config/blog.php` to match.

A gate defined in your `App\Providers\AuthServiceProvider` could look like this:

```
Gate::define('preview blog entries', function ($user) {
  // Check for your own admin user model, or some other criteria!
  return $user instanceof \App\AdminUser;
});
```

Styling the frontend
--------------------

[](#styling-the-frontend)

The included CSS file is built using [Kingdom CSS](https://bjuppa.github.io/kingdom/), which is yet another CSS framework, created by... yours truly.

The default styling is meant to add some consistent styling to the standard HTML elements, so a blog using it will not look "designed", although it has some opinionated layout and spacing (especially on a larger screen). You could say it has a ["brutalist"](https://brutalist-web.design) approach, it even uses browsers' default fonts.

### Using the included utility classes

[](#using-the-included-utility-classes)

Blog authors may want to add some special styles to elements within their entries. Some classes are useful on elements that are on the first level within entry contents:

- `.full-bleed` will expand the element to cover the entire width of the viewport - great for images.
- `.start-margin-bleed` and `.end-margin-bleed` will make the element extend into the left or right margin.
- `.float-right` and `.float-left` will float the element in single-column view.
- `.span-content` will make the element cover both columns when the screen is big enough for a two-column view - good for elements that require more space, but not the full width.
- `.full-column-bleed` is similar to `.full-bleed` but will not cover multiple columns.
- `.blog-related-content` will move the the element into the first available row of the second column - great for `` elements and other content that is related to the entry, but doesn't need to follow exactly in the flow.

    (The ads section is an example of this, that goes into the first free slot of the second column)

    If your related content needs to cover more than one row in the second column, you can add utility classes `.grid-row-span-2`, `.grid-row-span-3`, etc (from Kingdom).

The included CSS contains many of Kingdom's utility classes, they're too many to document here, please refer to the original SASS files:

- [`_colors.scss`](https://github.com/bjuppa/kingdom/blob/master/src/utilities/_colors.scss)
- [`_borders.scss`](https://github.com/bjuppa/kingdom/blob/master/src/utilities/_borders.scss)
- [`_sizing.scss`](https://github.com/bjuppa/kingdom/blob/master/src/utilities/_sizing.scss)
- [`_spacing.scss`](https://github.com/bjuppa/kingdom/blob/master/src/utilities/_spacing.scss)
- [`layout/_lists.scss`](https://github.com/bjuppa/kingdom/blob/master/src/utilities/layout/_lists.scss)
- [`layout/_screenreaders.scss`](https://github.com/bjuppa/kingdom/blob/master/src/utilities/layout/_screenreaders.scss)
- [`layout/_floats.scss`](https://github.com/bjuppa/kingdom/blob/master/src/utilities/layout/_floats.scss)
- [`layout/_grid.scss`](https://github.com/bjuppa/kingdom/blob/master/src/utilities/layout/_grid.scss)
- [`text/_whitespace-wrapping.scss`](https://github.com/bjuppa/kingdom/blob/master/src/utilities/text/_whitespace-wrapping.scss)

### Creating your own styles

[](#creating-your-own-styles)

You probably want to create your own styles to apply your personal touch or branding. The `stylesheets` config in your `config/blog.php` is where you can include any CSS files you want into your blog.

You can add a list of files so you can combine this package's CSS file with an additional CSS file containing your own styles. Or you can use [Laravel Mix](https://laravel.com/docs/mix)to combine them into a single file.

Blade templates
---------------

[](#blade-templates)

The package keeps all its Blade views in [`resources/views`](https://github.com/bjuppa/laravel-blog/tree/master/resources/views)and running this command will publish all of them into `resources/views/vendor/blog` of your app so you can edit them:

```
php artisan vendor:publish --provider="Bjuppa\LaravelBlog\BlogServiceProvider" --tag="blog-views"
```

...however you probably only need to change a few bits in just some files. I'd recommend you to only commit the files you actually change to version control, and remove the rest of the published files that you have not changed from your app. Blade will fall back to using the package's views for any file not found in the `vendor` view directory.

Localization
------------

[](#localization)

This package contains English translation strings that can be published to your app using this command:

```
php artisan vendor:publish --provider="Bjuppa\LaravelBlog\BlogServiceProvider" --tag="blog-translations"
```

If you're not adding translations for a new language, you probably don't need all the files and not even all the strings within a file. Consider overriding just the ones you want, as explained in the [Laravel documentation](https://laravel.com/docs/localization#overriding-package-language-files).

Custom entry providers and models
---------------------------------

[](#custom-entry-providers-and-models)

It is possible to pull out any configured `Blog` from the `BlogRegistry` within the `boot()` method of any Laravel service provider, and manipulate it beyond what is possible using the configuration files alone.

To use a custom `BlogEntryProvider` one can set it on an individual `Blog` using `withEntryProvider()`.

To just use a custom entry model with a `Blog` one can use `getEntryProvider()->withEntryModel()`, as long as the entry provider is a `Bjuppa\LaravelBlog\Eloquent\BlogEntryProvider`.

Background
----------

[](#background)

When looking for ways to add a simple blog to an existing Laravel app I found [many packages](https://packagist.org/?q=laravel%20blog)and some complete Laravel apps, but none of them did what I expected:

**Provide a highly configurable blog add-on that can be integrated into any Laravel app**.

Povilas Korop had written [a blog post about it](https://quickadminpanel.com/blog/blog-packages-for-laravel-nothing-to-choose-from/)some half a year before I ran into the same need. This package is my attempt at getting myself a couple of blogs without resorting to WordPress and hopefully provide something useful for other developers.

### My needs were

[](#my-needs-were)

- One ore more blogs must be configurable within the same Laravel app
- Simple configuration after package install (ideally just running migrations if only one standard blog)
- Publish [Atom feeds](https://en.wikipedia.org/wiki/Atom_(standard))
- Provide a default Eloquent model for posts/entries, but make it user replaceable per blog
- Configurable urls to avoid clashes with existing app routes
- Flexible and replaceable default views
- Named routes for easy linking from the rest of the Laravel app
- Optional admin panel, so you can write or use your own admin pages if you already have one

###  Health Score

59

—

FairBetter than 98% of packages

Maintenance81

Actively maintained with recent releases

Popularity32

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity88

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 98.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~78 days

Recently: every ~6 days

Total

37

Last Release

102d ago

Major Versions

0.9 → v1.02018-10-10

PHP version history (6 changes)v0.1PHP ^7.1.0

v0.5PHP ^7.1.3

v1.8.1PHP ^7.3

v1.8.2PHP ^7.3 || ^8.0

v1.9.0PHP ^8.0

v1.10.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/c7d75e38113b7a075f11d2d715ab47987cb6f37d6758d111d65858aaf44fe4a5?d=identicon)[bjuppa](/maintainers/bjuppa)

---

Top Contributors

[![bjuppa](https://avatars.githubusercontent.com/u/5339269?v=4)](https://github.com/bjuppa "bjuppa (831 commits)")[![Copilot](https://avatars.githubusercontent.com/in/1143301?v=4)](https://github.com/Copilot "Copilot (11 commits)")

---

Tags

blog-platformhacktoberfestlaravel-packagelaravelblog

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/bjuppa-laravel-blog/health.svg)

```
[![Health](https://phpackages.com/badges/bjuppa-laravel-blog/health.svg)](https://phpackages.com/packages/bjuppa-laravel-blog)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.6k29.9M146](/packages/laravel-cashier)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k15.1M132](/packages/laravel-pulse)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M131](/packages/roots-acorn)[api-platform/laravel

API Platform support for Laravel

58171.4k14](/packages/api-platform-laravel)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1235.9k20](/packages/fleetbase-core-api)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
