Download the PHP package netbrothers-gmbh/version-bundle without Composer

On this page you can find all versions of the php package netbrothers-gmbh/version-bundle. 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 version-bundle

build status

NetBrothers Version Bundle

This hybrid package works as a Symfony bundle or as a standalone PHP package for managing versioned tables in MariaDB and MySQL databases. It makes use of the Doctrine ORM to interact with your database.

NOTE: This package is designed to work with MariaDB/MySQL. It is not considered to work with other RDBMS.

In essence, this package provides one command which does two things.

  1. Create Version Tables
    For tables (e.g. orig_table) with a column named version of type INT/BIGINT the script will create a corresponding version table (e.g. orig_table_version) so that origin and version tables are structurally identical.

  2. Create Version Triggers
    For every versioned origin table the script creates a trigger, which will on INSERTs and UPDATEs increase the version number in the version column and save a copy of the row in the version table.

Installation

On the command prompt, change into your project's root directory and execute:

There are three installation variants:

Standalone Package

No further installation steps are necessary.

Symfony Bundle with Flex

No further installation steps are necessary. Symfony Flex will automatically register the bundle in config/bundles.php.

Symfony Bundle without Flex

You have to enable the bundle by adding it to the list of registered bundles in the file config/bundles.php in your project.

Configuration

Symfony Bundle

Copy the file netbrothers_version.yaml from the install folder of this package to your Symfony project's config path.

Doctrine Migrations

If you are using Doctrine Migrations instruct it to ignore your version tables, by using/customizing the schema filter option. If you don't have any other schema filter, you might use this: schema_filter: ~(?<!_version)$~. See in the example file how it's done.

NOTE: If you don't filter your version tables, Doctrine may drop them on the next occasion.

Bundle Configuration

You can specify certain columns (by name) to always be ignored by the compare algorithm when creating versions. See how it's done in the example file netbrothers_version.yaml.

Standalone

In most PHP frameworks you will have a PSR-11 compatible container to manage your dependencies. You'll have to provide this container to the script via a file argument.

The script will check if the provided container implements the PSR-11 ContainerInterface. If it does, it will assume an instance of the Doctrine EntityManagerInterface by the identifier EntityManagerInterface::class. Here's an example on how to check, if your container file works properly.

In standalone mode, ignoring tables and columns is controlled by command line options.

Usage

Prepare your Entities/Origin Tables

Add a column named version (type INT/BIGINT) to every table you want to be versioned. This can be done by adding the Trait VersionColumn to your entities and then creating and applying a migration.

Create Version Tables and Triggers

Issue the following command.

For every table with a version-column the command will

Create Version Tables and Triggers for a Single Table

If needed, you can apply the versioning to a single table. This can be done by providing the table name as an argument to the console command.

Command Line Options

The version command provides these options (sub commands).

Option Meaning
--create-trigger (default) drop triggers, create non-existent version tables, recreate triggers
--drop-trigger drop triggers
--drop-version drop triggers, drop version tables
--sql print the SQL statements without doing anything
--summary print a human readable summary of what the command would do

Licence

MIT

Authors

nb.logo


All versions of version-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
symfony/console Version >=7 <8
doctrine/orm Version *
doctrine/dbal Version ^3.8
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 netbrothers-gmbh/version-bundle contains the following files

Loading the files please wait ....