PHPackages                             novius/laravel-publishable - 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. novius/laravel-publishable

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

novius/laravel-publishable
==========================

A Laravel Eloquent model trait for publishable resource

3.1.1(10mo ago)210.2k↓32.6%2AGPL-3.0-or-laterPHPPHP &gt;=8.2CI passing

Since Jun 23Pushed 10mo ago3 watchersCompare

[ Source](https://github.com/novius/laravel-publishable)[ Packagist](https://packagist.org/packages/novius/laravel-publishable)[ Docs](https://github.com/novius/laravel-publishable)[ RSS](/packages/novius-laravel-publishable/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (6)Versions (7)Used By (2)

Laravel Publishable
===================

[](#laravel-publishable)

[![Novius CI](https://github.com/novius/laravel-publishable/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/novius/laravel-publishable/actions/workflows/main.yml)[![Packagist Release](https://camo.githubusercontent.com/62d4c4d00ccbf73a73d07931fd165307576fdfe3a1059e6e2dde666422ef3aa0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e6f766975732f6c61726176656c2d6e6f76612d7075626c69736861626c652e7376673f6d61784167653d31383030267374796c653d666c61742d737175617265)](https://packagist.org/packages/novius/laravel-nova-publishable)[![License: AGPL v3](https://camo.githubusercontent.com/c61341f63648cdd5aba4f7a073b513106a63778c27b15f96c56157642bc943b4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4147504c25323076332d626c75652e737667)](http://www.gnu.org/licenses/agpl-3.0)

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

[](#introduction)

A package for making Laravel Eloquent models "publishable" using 4 states : draft, published, unpublished and scheduled. Manage an additional `published_first_at` date for order by and display.

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

[](#requirements)

- Laravel &gt;= 10.0
- PHP &gt;= 8.2

> **NOTE**: These instructions are for Laravel &gt;= 10.0 and PHP &gt;= 8.2 If you are using prior version, please see the [previous version's docs](https://github.com/novius/laravel-publishable/tree/2.x).

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

[](#installation)

You can install the package via composer:

```
composer require novius/laravel-publishable
```

```
php artisan vendor:publish --provider="Novius\Publishable\LaravelPublishableServiceProvider" --tag=lang
```

Usage
-----

[](#usage)

#### Migrations

[](#migrations)

```
Schema::create('posts', function (Blueprint $table) {
    $table->id();
    $table->string('title');
    $table->text('text');
    $table->timestamps();
    $table->publishable(); // Macro provided by the package
});
```

#### Eloquent Model Trait

[](#eloquent-model-trait)

```
namespace App\Models;

use \Illuminate\Database\Eloquent\Model;
use \Novius\LaravelPublishable\Publishable;

class Post extends Model {
    use Publishable;
    ...
}
```

#### Extensions

[](#extensions)

The extensions shipped with this trait include; `notPublished`, `published`, `onlyDrafted`, `onlyExpired`, `onlyWillBePublished` and can be used accordingly:

```
$post = Post::first();
$post->isPublished();

$postsPublished = Post::all();
$postsPublished = Post::query()->published();
$onlyNotPublishedPosts = Post::query()->notPublished();
$onlyDraftedPosts = Post::query()->onlyDrafted();
$onlyExpiredPosts = Post::query()->onlyExpired();
$onlyWillBePublishedPosts = Post::query()->onlyWillBePublished();
```

### Testing

[](#testing)

```
composer run test
```

CS Fixer
--------

[](#cs-fixer)

Lint your code with Laravel Pint using:

```
composer run cs-fix
```

Licence
-------

[](#licence)

This package is under [GNU Affero General Public License v3](http://www.gnu.org/licenses/agpl-3.0.html) or (at your option) any later version.

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance53

Moderate activity, may be stable

Popularity28

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 90% 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 ~146 days

Recently: every ~178 days

Total

6

Last Release

329d ago

Major Versions

1.0.0 → 2.0.02023-07-10

2.x-dev → 3.0.02024-07-10

PHP version history (2 changes)1.0.0PHP &gt;=8.1

3.0.0PHP &gt;=8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/341860?v=4)[Novius](/maintainers/novius)[@novius](https://github.com/novius)

---

Top Contributors

[![felixgilles](https://avatars.githubusercontent.com/u/900854?v=4)](https://github.com/felixgilles "felixgilles (27 commits)")[![tonyyb](https://avatars.githubusercontent.com/u/11064382?v=4)](https://github.com/tonyyb "tonyyb (2 commits)")[![tony-novius](https://avatars.githubusercontent.com/u/243603340?v=4)](https://github.com/tony-novius "tony-novius (1 commits)")

---

Tags

laravellaravel-packagelaraveleloquentpublishpublishedunpublishpublishablelaravel-publishable

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/novius-laravel-publishable/health.svg)

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

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11120.2M21](/packages/anourvalar-eloquent-serialize)[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)[waad/laravel-model-metadata

A robust Laravel package for handling metadata with JSON casting, custom relation names, and advanced querying capabilities.

823.1k](/packages/waad-laravel-model-metadata)[mozex/laravel-scout-bulk-actions

A Laravel Scout extension for bulk importing and flushing of all models.

1033.4k](/packages/mozex-laravel-scout-bulk-actions)[indracollective/laravel-revisor

Draft, publish and revise Laravel Eloquent Models

197.4k1](/packages/indracollective-laravel-revisor)

PHPackages © 2026

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