Download the PHP package ampeco/fast-sqlite-refresh-database without Composer

On this page you can find all versions of the php package ampeco/fast-sqlite-refresh-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 fast-sqlite-refresh-database

Alternative to the default laravel behaviour that will refresh the sqlite database for each test.

Also, an alternative to squashing migrations, since that still has to import the squashed migration on each test.

In this implementation no transactions are used when starting a test and the database is refreshed by deleting the sqlite file and recreating it from a clean template!

Instructions

  1. Install the package

  2. Make sure you are not using in-memory database, but a sqlite file based one for your test setup
  3. In your test instead of use RefreshDatabase; use use FastSqliteRefreshDatabase;
  4. Run your tests

Performance

We tested it in an internal Feature testing suit with 86 tests. Using LazyRefreshDatabase we got:

Then we switched to FastSqliteRefreshDatabase and got:

Additional speed improvement

Preheating the database

If you are running a lot of test in CI for example. You can call php artisan fast-sqlite-refresh-database:preheat before running your tests. This will create a clean sqlite database file that can be copied for each test. This will speed up your tests even more!

In order to tell your tests to use the preheated database, you can set the environment variable FAST_SQLITE_REFRESH_DATABASE_PREHEATED to true before running your tests.

Here is the same test with preheated database:

Ramdisk

Running a large set of tests can create a lot of IO, for this reason you can use a ramdisk to store the sqlite database file.

On macOS you could use APFS or HFS+ ramdisk. From our tests HFS+ appears to be faster by 3-4%.

To unmount the ramdisk:

On linux you can use tmpfs


All versions of fast-sqlite-refresh-database with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
laravel/framework Version ^8.0|^9.0|^10.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 ampeco/fast-sqlite-refresh-database contains the following files

Loading the files please wait ....