Download the PHP package izniburak/nur-migration without Composer

On this page you can find all versions of the php package izniburak/nur-migration. 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 nur-migration

Phpmig

Build
Status

What is it?

Phpmig is a (database) migration tool for php, that should be adaptable for use with most PHP 5.3+ projects. It's kind of like doctrine migrations, without the doctrine. Although you can use doctrine if you want. And ironically, I use doctrine in my examples.

How does it work?

Phpmig aims to be vendor/framework independent, and in doing so, requires you to do a little bit of work up front to use it.

Phpmig requires a bootstrap file, that must return an object that implements the ArrayAccess interface with several predefined keys. We recommend returning an instance of Pimple, a simple dependency injection container. This is also an ideal opportunity to expose your own services to the migrations themselves, which have access to the container, such as a schema management abstraction.

Getting Started

The best way to install phpmig is using composer:

You can then use the localised version of phpmig for that project

Phpmig can do a little configuring for you to get started, go to the root of your project and:

Note that you can move phpmig.php to config/phpmig.php, the commands will look first in the config directory than in the root.

Phpmig can generate migrations using the generate command. Migration files are named versionnumber_name.php, where version number is made up of 0-9 and name is CamelCase or snake_case. Each migration file should contain a class with the same name as the file in CamelCase.

Better Persistence

The init command creates a bootstrap file that specifies a flat file to use to track which migrations have been run, which isn't great. You can use the provided adapters to store this information in your database.

Postgres PDO SqlPgsql

Adds support for qualifying the migrations table with a schema.

Or you can use Doctrine's DBAL:

Setting up migrations with Zend Framework requires a couple additional steps. You first need to prepare the configuration. It might be in any format supported by Zend_Config. Here is an example in YAML for MySQL:

In configuration file you need to provide the table name where the migrations will be stored and a create statement. You can use one of the configurations provided in the config folder for some common RDBMS.

Here is how the bootstrap file should look:

Example with Eloquent ORM 5.1

Writing Migrations

The migrations should extend the Phpmig\Migration\Migration class, and have access to the container. For example, assuming you've rewritten your bootstrap file like above:

Customising the migration template

You can change the default migration template by providing the path to a file in the phpmig.migrations_template_path config value. If the template has a .php extension it is included and parsed as PHP, and the $className variable is replaced:

If it uses any other extension (e.g., .stub or .tmpl) it's parsed using the sprintf function, so the class name should be set to %s to ensure it gets replaced:

Module Migrations

If you have an application that consists of different modules and you want to be able to separate the migration, Phpmig has a built-in way to achieve this.

this way each set has their own migration log and the ability to migrate changes independently of each other.

to run the set migration you just use the command below:

For example, if a change was made to the cms migration, you'll type in this command:

and the migration tool will run the migration setup for cms.

to downgrade a migration would be:

Multi path migrations

By default you have to provide the path to migrations directory, but you can organize your migrations script however you like and have several migrations directory. To do this you can provide an array of migration file paths to the container :

You can then provide a target directory to the generate command. The target directory is mandatory if you haven't provided a phpmig.migrations_path config value.

Rolling Back

You can roll back the last run migration by using the rollback command

To rollback all migration up to a specific migration you can specify the rollback target

or

By specifying 0 as the rollback target phpmig will revert all migrations

You can also rollback only a specific migration using the down command

Using Outside CLI

In order to use the migration tool outside the cli context use Phpmig\Api\PhpmigApplication.

Todo

Contributing

Feel free to fork and send me pull requests, I try and keep the tool really basic, if you want to start adding tons of features to phpmig, I'd recommend taking a look at robmorgan/phinx.

Inspiration

I basically started copying ActiveRecord::Migrations in terms of the migration features, the bootstrapping was my own idea, the layout of the code was inspired by Symfony and Behat

Copyright

Pimple is copyright Fabien Potencier. Everything I haven't copied from anyone else is Copyright (c) 2011 Dave Marshall. See LICENCE for further details


All versions of nur-migration with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
symfony/console Version ^6.4
symfony/config Version ^6.4
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 izniburak/nur-migration contains the following files

Loading the files please wait ....