Download the PHP package avocet-shores/laravel-rewind without Composer

On this page you can find all versions of the php package avocet-shores/laravel-rewind. 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 laravel-rewind

Laravel Rewind

Latest Version on Packagist GitHub Tests Action Status Coverage Status GitHub Code Style Action Status Total Downloads

Laravel Rewind is a powerful, easy-to-use versioning package for your Eloquent models.

Imagine you have a Post model and want to track how it evolves over time:

You can also view a list of previous versions of a model, see what changed, and even jump to a specific version.

How It Works

Under the hood, Rewind stores a combination of partial diffs and full snapshots of your model’s data. The interval between full snapshots is determined by the rewind.snapshot_interval config value. This provides you with a customizable trade-off between storage cost and performance. Rewind's engine will automatically determine the shortest path between your current version, available snapshots, and your target.

How does Rewind handle history?

Rewind maintains a simple linear history of your model’s changes, but what exactly happens when you update a model while on an older version? Let's take a look:

  1. You create a new version of your model:

  2. You rewind to a previous version:

  3. You update the model while on an older version:

  4. What version are we on now, and what data is in it?

In order to maintain a linear, non-destructive history, Rewind uses the previous head version as the content of the old_values for the new version you just created. It also creates a full snapshot of the model’s current state and designates it as the new head. So the current version in our above example looks like this:

In other words, your model's history will always look like it updated from the previous head version. This way, you can always see what changed between versions, even if you jump back and forth in time. And you can always revert to a previous version without fear of losing data.

Thread Safety

Rewind is designed with thread-safety in mind. Before creating a new version, Rewind must acquire a cache lock for that specific record. This ensures that only one process can create a new version at a time. If a process is unable to acquire the lock, it will wait for a set period of time before throwing an exception.

Installation

You can install the package via composer:

You can publish and run the migrations, and publish the config, with:

Getting Started

To enable version tracking on a model, follow these two steps:

1. Add the Rewindable trait to your Eloquent model:

2. Add the current_version column to your model’s table:

In order to function properly, Rewind needs to track which version your model is currently on. You can use our convenient artisan command to generate a migration to do just that:

That’s it! Now your model’s changes are recorded in the rewind_versions table, and you can jump backwards or forwards in time.

Usage

Creating/Updating a Model

Using the Rewind Facade

Excluding attributes from versioning

If you have attributes that you don't want to track, you can exclude them by adding an excludedFromVersioning method to your model:

Build a specific version's attributes

Because Rewind stores a combination of partial diffs and snapshots, there's no guarantee a RewindVersion contains all the data for a version. However, the getVersionAttributes method will build and return a complete set of attributes for a specific version.

Clone a Model at a specific version

You can clone a model by using the cloneModel function. This will create a new model and fill it with the attributes from the specified version.

Initialize a v1 on your model without making any changes

If you have an existing model and want to add a v1 record without making any changes, you can call the initVersion function directly from your Rewindable model.

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-rewind with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^10.0||^11.0||^12.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 avocet-shores/laravel-rewind contains the following files

Loading the files please wait ....