PHPackages                             chrisjk123/laravel-blogger - 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. [Database &amp; ORM](/categories/database)
4. /
5. chrisjk123/laravel-blogger

ActiveLibrary[Database &amp; ORM](/categories/database)

chrisjk123/laravel-blogger
==========================

blog package

1.1.0(6y ago)129MITJavaScriptPHP ^7.1CI failing

Since Jan 19Pushed 6y ago2 watchersCompare

[ Source](https://github.com/chrisjk123/laravel-blogger)[ Packagist](https://packagist.org/packages/chrisjk123/laravel-blogger)[ Docs](https://github.com/chrisjk123/laravel-blogger)[ RSS](/packages/chrisjk123-laravel-blogger/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)Dependencies (4)Versions (3)Used By (0)

Add blog database tables to a Laravel app
=========================================

[](#add-blog-database-tables-to-a-laravel-app)

[![GitHub version](https://camo.githubusercontent.com/f9254129eff005fcbb3470adf370ecfbdfc6463bb09ea485e4ada2062d9faa4e/68747470733a2f2f62616467652e667572792e696f2f67682f63687269736a6b3132332532466c61726176656c2d626c6f676765722e737667)](https://packagist.org/packages/chrisjk123/laravel-blogger)[![build status](https://camo.githubusercontent.com/5e2a5aba0667772aa3ff5573d58881f6fb78d38056449b7c53c4a18320710aba/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f63687269736a6b3132332f6c61726176656c2d626c6f676765722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/chrisjk123/laravel-blogger)[![code quality](https://camo.githubusercontent.com/ea38170d512230f00d6425f1995ec607367970fc3c135f796aace058c54c3ff8/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f63687269736a6b3132332f6c61726176656c2d626c6f676765722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/chrisjk123/laravel-blogger)[![downloads](https://camo.githubusercontent.com/6313a2aee0d25cd09bf701ffce19f61da954ebb6fc74c3d054bd77f4642914df/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f63687269736a6b3132332f6c61726176656c2d626c6f676765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/chrisjk123/laravel-blogger)[![License: MIT](https://camo.githubusercontent.com/1a2e0606685ce00663bf829868f794fd3fc9c86f8d80cae324734129e0723a58/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d627269676874677265656e2e737667)](https://opensource.org/licenses/MIT)

Table of Contents
-----------------

[](#table-of-contents)

- [Introduction](#introduction)
- [Requirements](#requirements)
- [Installation](#installation)
- [Testing](#testing)
- [Usage](#usage)
- [Changelog](#changelog)
- [Security](#security)
- [Credits](#credits)
- [License](#license)

Introduction
------------

[](#introduction)

This package is a blogging database with maxed out models, migrations and seeders to help get you setup. After the package is installed the only thing you have to do is add the `HasPosts` trait to an Eloquent model to associate the users.

Here are some code examples:

```
// Alias namespace path:
// Chriscreates\Blog\Post
// Chriscreates\Blog\Category
// Chriscreates\Blog\Tag
// Chriscreates\Blog\Comment

// Search by the short whereCategories method OR use whereCategory() and specify the field
$results = Post::whereCategories($categories = null)->get();
$results = Post::whereCategory($field, $operator, $value)->get();

// Search by Category ID OR IDs
$results = Post::whereCategories(1)->get();
$results = Post::whereCategory('id', 1)->get();
----------
$results = Post::whereCategories([3, 6, 7])->get();
$results = Post::whereCategory('id', [3, 6, 7])->get();

// Search by Category name OR names
$results = Post::whereCategories('Izabella Bins II')->get();
$results = Post::whereCategory('name', 'Izabella Bins II')->get();
----------
$results = Post::whereCategories(['Izabella Bins II', 'Osborne Fay'])->get();
$results = Post::whereCategory('name', ['Izabella Bins II', 'Osborne Fay'])->get();

// Search by Category model or a Category Collection
$category = Category::where('id', 7)->first();
$results = Post::whereCategories($category)->get();
----------
$categories = Category::whereIn('id', [3, 6, 7])->get();
$results = Post::whereCategories($categories)->get();

// Search by related Post (tags or category)
$post = Post::find(8);
$results = Post::relatedByPostTags($post)->get();
----------
$results = Post::relatedByPostCategory($post)->get();

// Search by published Posts only
Post::published()->get();
----------
Post::publishedLastMonth()->get();
----------
Post::publishedLastWeek()->get();

// Search by unpublished Posts only
Post::notPublished()->get();

// Search by scheduled Posts only
Post::scheduled()->get();

// Search by drafted Posts only
Post::draft()->get();

// Order by latest published
Post::orderByLatest()->get();
```

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

[](#requirements)

This package requires Laravel 5.8 or higher, PHP 7.2 or higher and a database that supports json fields and MySQL compatible functions.

Installation
------------

[](#installation)

> Note: Laravel Blogger requires you to have user authentication in place prior to installation. For Laravel 5.\* based projects run the `make:auth` Artisan command. For Laravel 6.\* based projects please see the official guide to get started.

You can install the package via composer:

```
composer require chrisjk123/laravel-blogger
```

Publish the primary configuration file using the `blog:install` Artisan command:

```
php artisan blog:install
```

This is the contents of the published config file, if your `User` class is within a different directory or has a different primary key it can be changed here.

```
/*
|--------------------------------------------------------------------------
| User relations
|--------------------------------------------------------------------------
|
| This is the default path to the User model in Laravel and primary key.
| You are free to change this path to anything you like.
|
*/

'user' => [
    'user_class' => \App\User::class,
    'user_key_name' => 'id',
],
```

Optionally you can follow the [artesaos/seotools](https://github.com/artesaos/seotools#in-your-view) guide to help provide some common SEO techniques for your public frontend:

```
{{-- Within the head of your app.blade.php file --}}
{!! SEOMeta::generate() !!}
{!! OpenGraph::generate() !!}
```

Testing
-------

[](#testing)

Run the tests with:

```
composer test
```

Usage
-----

[](#usage)

All you have to do is add the `HasPosts` to your User model to get started.

```
namespace App;

use Chriscreates\Blog\Traits\User\HasPosts;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;

class User extends Authenticatable
{
    use Notifiable, HasPosts;

    // ...
}

// Retrieve the posts created by the user(s)
$user->posts;

// Retrieve the comments created by the guest/user(s)
$user->comments;
```

```
{{-- Print the published post markdown content --}}
{!! $post->parsed_markdown !!}
```

Furthermore, in the configuration file, the default is set to true for allowing both user and public commenting on posts is set here.

```
/*
 |--------------------------------------------------------------------------
 | Post commenting options
 |--------------------------------------------------------------------------
 |
 | The default for commenting on posts is enabled, as well as guest
 | commenting. Feel free to change these conditions to false.
 |
 */

'posts' => [
    'allow_comments' => true,
    'allow_guest_comments' => true,
],
```

You can get setup quickly by using the `blog:setup` Artisan command. This publishes the routes, controllers and views. Optionally you can seed the database with `factory()` data by specifying the data `--data` option.

```
php artisan blog:setup --data
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Christopher Kelker](https://github.com/chrisjk123)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~54 days

Total

2

Last Release

2251d ago

### Community

Maintainers

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

---

Top Contributors

[![chrisjk123](https://avatars.githubusercontent.com/u/25506653?v=4)](https://github.com/chrisjk123 "chrisjk123 (47 commits)")

---

Tags

blogchirsjk123databaselaravellaravel-bloggerphpvuelaravelblogbloggerchrisjk123laravel-blogger

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/chrisjk123-laravel-blogger/health.svg)

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

###  Alternatives

[tpetry/laravel-postgresql-enhanced

Support for many missing PostgreSQL specific features

9982.0M14](/packages/tpetry-laravel-postgresql-enhanced)[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)[biiiiiigmonster/hasin

Laravel framework relation has in implement

154552.4k](/packages/biiiiiigmonster-hasin)[dragon-code/laravel-deploy-operations

Performing any actions during the deployment process

240173.5k2](/packages/dragon-code-laravel-deploy-operations)[bavix/laravel-clickhouse

Eloquent model for ClickHouse

72214.1k2](/packages/bavix-laravel-clickhouse)[stayallive/laravel-eloquent-observable

Register Eloquent model event listeners just-in-time directly from the model.

2928.9k7](/packages/stayallive-laravel-eloquent-observable)

PHPackages © 2026

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