Download the PHP package proai/eloquent-versioning without Composer

On this page you can find all versions of the php package proai/eloquent-versioning. 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 eloquent-versioning

Eloquent Versioning

Latest Stable Version Total Downloads Latest Unstable Version License

This is an extension for the Eloquent ORM to support versioning. You can specify attributes as versioned. If an attribute is specified as versioned the value will be saved in a separate version table on each update. It is possible to use timestamps and soft deletes with this feature.

Installation

Eloquent Versioning is distributed as a composer package. So you first have to add the package to your composer.json file:

Then you have to run composer update to install the package.

Example

We assume that we want a simple user model. While the username should be fixed, the email and city should be versionable. Also timestamps and soft deletes should be versioned. The migrations would look like the following:

The referring Eloquent model should include the code below:

Usage

Database Tables

You need to add the following columns to your main model table:

Furthermore you need a version table. The name of the version table is identical with the name of the main model table (e. g. for a model table users the name would be users_version). This table must contain the following columns:

Eloquent Models

You have to define a $versioned array in your model that contains all versioned columns.

Database Queries

Query the database

By default the query builder will fetch the latest version (e. g. User::find(1); will return the latest version of user #1). If you want a specific version or all versions, you can use the following:

Create, update and delete records

All these operations can be performed normally. The package will automatically generate a version 1 on create, the next version on update and will remove all versions on delete.

Timestamps

You can use timestamps in two ways. For both you have to set $timestamps = true;.

Soft Deletes

If you use the Versionable trait with soft deletes, you have to use the ProAI\Versioning\SoftDeletes trait from this package instead of the Eloquent soft deletes trait.

Custom Query Builder

If you want to use a custom versioning query builder, you will have to build your own versioning trait, but that's pretty easy:

Obviously you have to replace MyVersioningBuilder by the classname of your custom builder. In addition you have to make sure that your custom builder implements the functionality of the versioning query builder. There are some strategies to do this:

Support

Bugs and feature requests are tracked on GitHub.

License

This package is released under the MIT License.


All versions of eloquent-versioning with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
illuminate/database Version 5.*
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 proai/eloquent-versioning contains the following files

Loading the files please wait ....