Search by

huseyinfiliz / flarum-diff

huseyinfiliz

View post edit histories.

Package info

github.com/huseyinfiliz/flarum-diff

Type:flarum-extension

pkg:composer/huseyinfiliz/flarum-diff

Statistics

Installs: 2 448

Dependents: 0

Suggesters: 0

Stars: 4

Open Issues: 0

2.1.1 2026-11-17 16:38 UTC

This package is auto-updated.

Last update: 2026-11-17 16:40:52 UTC


README

MIT license Latest Stable Version Total Downloads

This extension adds a "post revision history" feature to your Flarum forum.

Note: This is the Flarum 2.x compatible version of the original the-turk/flarum-diff extension (which supports Flarum 1.8.x). This fork has been updated to work with Flarum 2.0 and later versions.

Screenshots:

Diff Collage

Features

  • Based on jfcherng/php-diff repository (this one is forked from chrisboulton/php-diff since it's no longer maintained).
  • Option for line (default), word and char level diffs.
  • Three render modes including "Inline", "Side By Side" & "Combined".
  • Archive old revisions using cron jobs or manually.
  • Delete revisions or rollback to certain revision.
  • Add an optional edit reason when editing a post, visible to readers with edit history access.
  • Supports all browsers which are supporting css-grid.

Also, it won't load (and cache) anything until you click the "Edited" button so no need to worry about loading times.

Requirements

php ext-iconv

You can check your php version by running php -v and check if iconv is installed by running php --ri iconv (which should display iconv support => enabled).

Installation

composer require huseyinfiliz/flarum-diff:"*"

Updating

composer update huseyinfiliz/flarum-diff --with-dependencies
php flarum migrate
php flarum cache:clear

Upgrading from the-turk/flarum-diff

⚠️ IMPORTANT: Database Backup Required

Before upgrading, you must backup your database. While our tests showed no data loss during migration, there is always a risk when upgrading major versions. Your revision history data is stored in the post_edit_histories and post_edit_histories_archive tables.

In our tests, all revision data was preserved successfully after the upgrade.

ℹ️ About Settings Migration

Extension settings from the-turk/flarum-diff (1.8.x) will not be transferred to this version. This is because the settings prefix has changed from the-turk-diff.* to huseyinfiliz-diff.*.

This is not a critical issue - after installing this extension, you simply need to configure your settings manually in the admin panel. This only affects display preferences (detail level, neighbor lines, merge threshold, archive options, etc.) and does not affect your revision history data in any way. All your stored revisions will continue to work normally with the default settings until you customize them.

To upgrade from the original extension:

  1. Backup your database (mandatory)
  2. Disable the old extension in admin panel
  3. Remove the old extension:
    composer remove the-turk/flarum-diff
  4. Upgrade Flarum to 2.0:
    composer require flarum/core:"^2.0"
    # Follow Flarum's upgrade guide
  5. Install this extension:
    composer require huseyinfiliz/flarum-diff:"*"
  6. Run migrations and clear cache:
    php flarum migrate
    php flarum cache:clear
  7. Enable the extension in admin panel
  8. Configure your settings in the admin panel (settings from 1.8.x will not be migrated)

Summary: Your revision history data will be fully preserved. Only extension settings need to be reconfigured manually.

Usage

Enable the extension and set the permissions. You're ready to go!

Edit Reasons

When editing a post, authors and moderators can optionally enter a plain-text reason of up to 500 characters. The reason belongs to the new revision and is shown in the revision list and history modal. It uses the existing edit history viewing permission and is permanently removed when that revision is deleted. Older revisions remain compatible and display no reason unless one was recorded.

Editing only the reason does not create a revision or rewrite an existing reason. Rollbacks create a new revision without copying the restored revision's reason. If only first-post revisions are enabled, the reason field is shown only when editing the first post.

The compact reason field uses an optional placeholder instead of a separate heading. Administrators can hide it using Show the edit reason field in the post editor, which is enabled by default. This display setting does not remove existing reasons or disable API integrations; stored reasons remain subject to the history viewing permission.

Archive Old Revisions

If x ≥ A (where the x is post's revision count), first y=mx+b revisions for the post can be stored as merged & compressed BLOB in a new table (which is called post_edit_histories_archive). Specify the A, m and b from the settings modal. Float values of y will be rounded to the next lowest integer value. It's recommended to archive old revisions if you want to save storage volume but not recommended if you don't want to.

If you want to archive old revisions, please consider enabling cron job option from the settings modal. I set a weekly cron job which is working on sundays at 02:00 AM (nothing special) using diff:archive command. Otherwise, it'll try to find & archive old revisions for the post as soon as Post\Revised event fires or wait for your php flarum diff:archive command. See this discussion for setting up the scheduler.

Links

Credits