Download the PHP package mylesduncanking/laravel-simple-migration without Composer

On this page you can find all versions of the php package mylesduncanking/laravel-simple-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 laravel-simple-migration

Install via composer

composer require mylesduncanking/laravel-simple-migration

Getting started

To use this an understanding of how Laravel's migrations work is required. "Migrations are like version control for your database, allowing your team to define and share the application's database schema definition. If you have ever had to tell a teammate to manually add a column to their local database schema after pulling in your changes from source control, you've faced the problem that database migrations solve." - Laravel documentation

To use simple migrations, create a new migration file using the same syntax as a default Laravel artisan migration but specify that you would like a simple-migration. For example php artisan make:simple-migration your_migration_name

Within the migration file you will see a new protected array property called $migration which is where you will define your migration logic.

The format of the $migration array is as follows:

Auto-after functionality

To save some time when adding multiple columns to a table, the default behaviour is changed to add columns sequentially. This removes the requirement of adding ->after('foobar') to every column modifier.

You can disable this behaviour by running php artisan vendor:publish --tag=simplemigration and changing config/simplemigration.php > auto_after to false

Auto-index functionality

To save some time you can use the automatic index feature. By default this will automatically add the ->index() modifier to any column ending in _id

You can modify these rules by running php artisan vendor:publish --tag=simplemigration and changing the values within the config/simplemigration.php > auto_index array. Note: These values are in a regex format.

You can also specify an auto-index column to not be indexed ad-hoc by passing the noIndex option in the modifiers array.

Table naming convention

Within the $migration property create a key for each table you want to migrate. Within each sub array is where you define the column changes.

If an id or uuid column is defined within the column set then the table will be created, otherwise it will be updated. You can overwrite this by prefixing the table name with either create: or update: depending on the method you would like to force.

You can modify these assumptions by running php artisan vendor:publish --tag=simplemigration and editing config/simplemigration.php > type_assumptions

For example:

How to format column keys

The column is passed as the key within the table array.

The format should be defined as { Type }:{ Column name }. For example integer:quantity

If you want to pass additional parameters to the type method you can seperate these by a comma. If an array is required seperate values with a pipe |. For example set:eye_color,blue|green|brown|other

If you don't pass a type then an assumption will be made as to what type should be used.

Assumed type
Ends in _id foreignId
Ends in _at timestamp
Anything else string

You can modify these assumptions by running php artisan vendor:publish --tag=simplemigration and editing config/simplemigration.php > create_triggers. Note: This is in a regex format.

More information on valid Laravel column types can be found in Laravel's documentation.

How to format column modifiers

As the value of each column you pass an array. This array can either be empty or define modifiers to the column.

Each value in the array should follow the format of { Modifier }:{ Parameters }. For example after:id

More information on valid Laravel column modifiers can be found in Laravel's documentation.

Example migration

The following migration creates a roles table and add a foreign key into the users table.


All versions of laravel-simple-migration with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3|^8.0|^8.1|^8.2
illuminate/database Version ^7.0|^8.0|^9.0|^10.0|^11.0
illuminate/support Version ^7.0|^8.0|^9.0|^10.0|^11.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 mylesduncanking/laravel-simple-migration contains the following files

Loading the files please wait ....