Download the PHP package a-h-abid/laravel-refresh-module-database without Composer

On this page you can find all versions of the php package a-h-abid/laravel-refresh-module-database. 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-refresh-module-database

Laravel Refresh Module Database

A Laravel database trait that can used in unit test for module packages like nwidart/laravel-modules, pingpong/modules, caffeinated/modules etc.

What it solves

TLDR; Speeds up Unit Tests by migrating only the required modules.

Long Story

I have a big laravel project where I'm using the popular nwidart/laravel-modules package for modularizing the codebase. There are about 20 modules and each of then have about 10-15 migration files. When I run php artisan migrate:fresh command, it takes 15-20 seconds just to complete all the migration. Now you can understand how much it frustrates when I have to unit test a small section, I have to wait 15-20 seconds just to complete migration then the unit test takes 100-200ms.

So I worked on this refresh database trait where I can choose to only migrate by specific modules. This really up the small unit tests by 90%.

Requirement

Note: This will not work for using in-memory database.

Install

Install using composer

Usage

Import the Trait to your test code. Best to import it on your base test class.

Next, add the below code in your test class for running module migration. Below example is for nwidart/laravel-modules package. If you are using any other package or any other mechanism, change the code inside as you need.

Finally add this code in your test class, which indicates the modules to migrate.

Now, run your phpunit and see the result. :)

How It Works

Similar to Laravel's Refresh Database trait, on initiation, it will drop all tables and then migrate the migration files once. Only difference here is that we can choose to only migrate specific modules in test class. Also once a module is migrated, it will not re-migrate / re-fresh on that test session.

Other Usage Options

  1. If you also need to run the migration files in project-root/database/migrations directory, add below method and set to true.

  2. If you need to migrate all files, set this env in your phpunit.xml file with value to true.

TODO

License

This project is licensed under the terms of the MIT license.


All versions of laravel-refresh-module-database with dependencies

PHP Build Version
Package Version
Requires laravel/framework Version >=6.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 a-h-abid/laravel-refresh-module-database contains the following files

Loading the files please wait ....