Download the PHP package kdabrow/time-machine without Composer

On this page you can find all versions of the php package kdabrow/time-machine. 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 time-machine

GitHub Workflow Status (branch) Packagist Version Packagist Downloads

Time machine

This package allows to move in time database data. It automatically selects all fields that store datetime and move them by given period or to particular date, relatively from it current value. See example to check more details.

Motivation

This package might be useful in a pre-prod environment to test log lasting processes. For example generating customer invoice. Usually invoices are generated in a 30 days period. You might move
customer and all it's data into previous invoice cycle (30 days in to past) and effectively simulate whole invoice cycle like that customer was created 30 days ago.

Installation

First install main package:

Then install database driver package:

Database Driver
mysql
postgres

Advice is to install those packages as --dev dependencies.

Usage

Time traveller setup

First create TimeTraveller. Only Eloquent model can be TimeTraveller. Basic configuration look like this:

Modify query

TimeMachine by default selects all rows related to given to TimeTraveller model. You're able to provide your conditions to restrict query

Additional columns

It's possible to add additional columns into query.

Exclude fields

Sometimes is need to omit some fields that would usually be selected to change.

Set up keys

Records selected to time travel are based on primary key from the model. You're able to overwrite it.

Time machine and direction of move

After TimeTravellers are created, create TimeMachine.

Move to the past

First create DateChooser. It is information about period or date.

Move to the future

First create DateChooser. It is information about period or date.

Move to particular date

First create DateChooser. It is information about period or date.

Examples

Move customer, it's payments and orders 10 days in the past

Database structure before and after change:
customers (before)

id email date_of_birth activated_at created_at updated_at
100 [email protected] 1856-07-10 2000-06-15 12:12:12 1999-06-15 12:12:12 1999-06-15 12:12:12

customers (after)

id email date_of_birth activated_at created_at updated_at
100 [email protected] 1856-07-10 2000-06-05 12:12:12 1999-06-05 12:12:12 1999-06-05 12:12:12

payments (before)

id customer_id amount paid_at created_at updated_at
200 100 120 2020-03-24 13:10:45 2020-03-24 10:10:45 2020-03-24 13:10:45

payments (after)

id customer_id amount paid_at created_at updated_at
200 100 120 2020-03-14 13:10:45 2020-03-14 10:10:45 2020-03-14 13:10:45

orders

id payment_id name sent_at created_at updated_at
300 200 Engine 2020-03-25 2020-03-24 13:11:22 2020-03-25 15:32:17

orders

id payment_id name sent_at created_at updated_at
300 200 Engine 2020-03-15 2020-03-14 13:11:22 2020-03-15 15:32:17

Script:

Testing

Run tests from docker container

or directly from your machine


All versions of time-machine with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2|^8.0
illuminate/database Version 6.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 kdabrow/time-machine contains the following files

Loading the files please wait ....