Publisher is a Laravel package that provides a complete content publishing workflow, allowing you to maintain both published and draft versions of your content simultaneously. Editors can work on changes without affecting the live published version until changes are explicitly published.
-
Install the package via composer:
composer require plank/publisher
-
Add the
Publishableinterface andIsPublishabletrait to your models:<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; use Plank\Publisher\Concerns\IsPublishable; use Plank\Publisher\Contracts\Publishable; class Post extends Model implements Publishable { use IsPublishable; }
-
Run the install command:
php artisan publisher:install
-
Add the publisher columns to your model if you did not generate them automatically:
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends SnapshotMigration { public function up() { Schema::table('posts', function (Blueprint $table) { $table->string('status'); $table->boolean('has_been_published'); $table->boolean('should_delete'); $table->json('draft')->nullable(); }); } }
-
Run migrations:
php artisan migrate
For complete documentation including configuration, features, and advanced usage, see the Documentation.
Quick Links:
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.
If you discover a security vulnerability within Publisher, please send an e-mail to security@plank.co. All security vulnerabilities will be promptly addressed.
Plank focuses on impactful solutions that deliver engaging experiences to our clients and their users. We're committed to innovation, inclusivity, and sustainability in the digital space. Learn more about our mission to improve the web.
