Download the PHP package proai/laravel-super-migrations without Composer

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

Laravel Super Migrations

Latest Stable Version Total Downloads Latest Unstable Version License

This is an extension for the Laravel migrations. It is useful when you have a big database that results in a lot of migration files. This package will help you to reduce the number of migration files and furthermore it will give you a better structure with which you will have all schema updates for a table in one file.

Installation

You can install the package via composer:

Usage

Basically we do not define table builder schemas by migration, but by table. For this purpose you need to create a tables folder in the database/migrations directory. For each table we will create a file in this new directory and link it in the migration files whereever needed. Here is a more detailed explanation:

Migration Classes

Firstly here is a migration file in the database/migrations folder. Notice that we extend the ProAI\SuperMigrations\Migration class. Instead of an up() and a down() method this class needs a schemas() method:

The schemas() method returns a list of all database tables that are affected by this migration (users and comments table in the example above). Since there can be more than one migration for a database table, we also need to assign a migration specific name for each table (i.e. create for the users and comments table).

With this pattern we can easily bundle schemas in one migration file. One more example: Let's say we want to add a roles table and a column for the role_id in the users table, then the schemas() method could look like the following:

The idea behind this is that one migration file includes all schemas for a whole update step rather than just for a table (i.e. one migration InitProject vs. multiple migrations CreateUsersTable, CreateCommentsTable etc.). This way you will have less migration files.

Table Classes

For each tablename that is returned by the schemas() method Laravel Super Migrations searches for a php file in database/migrations/tables with the same name (i.e. for the table users there must exist a file users.php). This file must contain a class that extends ProAI\SuperMigrations\Table and that is named after the table (in camel case) with a Table suffix. For example the classname must be UsersTable for a table users.

Furthermore for each of the migration specific names that we declared in the migration file, the table class must declare a method with the same name (i.e. a create method for the users table). Here is a sample users table class that fits to the migration class from the previous section:

We use $this->upSchema() and $this->downSchema() to define the up and down schema. These methods return a ProAI\SuperMigrations\Builder instance that is similar to the Laravel database schema builder (see Laravel docs). The only difference is that you don't need the tablename as first argument, because the tablename is already known. Furthermore we use $this->up(...) and $this->down(...) to insert custom code like raw DB statements (usually we don't need these methods).

Generator Command

Run php artisan make:super-migration to create a new migration class that fits to the pattern of this package. You can declare a custom path with the --path option. Note that you have to include the service provider in order to use this command (see installation section).

Support

Bugs and feature requests are tracked on GitHub.

License

This package is released under the MIT License.


All versions of laravel-super-migrations with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
illuminate/database Version ^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 proai/laravel-super-migrations contains the following files

Loading the files please wait ....