Download the PHP package visualbuilder/versionable without Composer

On this page you can find all versions of the php package visualbuilder/versionable. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package versionable

Latest Version on Packagist run-tests

Laravel Versionable (Polymorphic User Fork)

Fork of overtrue/laravel-versionable with polymorphic user support

This fork extends the original package to support polymorphic user relationships, allowing you to track versions created by different user model types (e.g., Admin, Associate, EndUser, etc.) in applications with multiple authentication guards.

It's a minimalist way to make your model support version history, and it's very simple to revert to the specified version.

What's Different in This Fork?

This fork replaces the single-user foreign key relationship with a polymorphic relationship, enabling:

Key Changes:

  1. Migration: Uses morphs('user') instead of unsignedBigInteger('user_id')
  2. Version Model: Uses morphTo() for the user relationship instead of belongsTo()
  3. Configuration: Removed user_model and user_foreign_key config options (no longer needed)
  4. Versionable Trait: New getVersionUser() method returns the authenticated user model

Requirement

  1. PHP >= 8.1.0
  2. laravel/framework >= 9.0

Features

Installing

Run:-

First, publish the config file and migrations:

Then run this command to create a database migration:

Usage

Add Visualbuilder\Versionable\Versionable trait to the model and set versionable attributes:

Versions will be created on the versionable model saved.

Polymorphic user example

Once you attach the trait to a versionable model, versions automatically store the currently authenticated user.

You can repeat the same pattern for any additional authenticatable model that should appear as a version author.

Get versions

Revert

Revert a model instance to the specified version:

Revert without saving

Remove versions

Restore deleted version by id

Temporarily disable versioning

Custom Version Store strategy

You can set the following different version policies through property protected $versionStrategy:

Show diff between the two versions

$diff is a object Visualbuilder\Versionable\Diff, it based on jfcherng/php-diff.

You can render the diff to many formats, and all formats result will be like follows:

toArray()

Other formats

Note

$differOptions and $renderOptions are optional, you can set them following the README of jfcherng/php-diff. $stripTags allows you to remove HTML tags from the Diff, helpful when you don't want to show tags.

Using custom version model

You can define $versionModel in a model, that used this trait to change the model(table) for versions

Note

Model MUST extend class \Visualbuilder\Versionable\Version;

Update the model attribute $versionModel:

Integrations

Credits

This package is a fork of overtrue/laravel-versionable.

All credit for the original implementation goes to @overtrue. This fork only adds polymorphic user support.

License

MIT


All versions of versionable with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
laravel/framework Version ^9.0|^10.0|^11.0|^12.0|^13.0
jfcherng/php-diff Version ^6.11
doctrine/dbal Version ^3.8|^4.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package visualbuilder/versionable contains the following files

Loading the files please wait ...