Download the PHP package spresnac/laravel-artisan-database-helper without Composer

On this page you can find all versions of the php package spresnac/laravel-artisan-database-helper. 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-artisan-database-helper

Laravel: Usefull Database helper

This package will provide you some helper for

PHP from Packagist Laravel Version

Downloads

Installation

First things first, so require the package:

That's all, you are ready to go now 😁

Usage

BackupDatabase

The 90% way

To backup your database, open up your console and type

and in most cases, you are done. You will find your backup in

Ok, with "most cases", i meant this:

If you have all of this, you are ready and good to go.

The other 10% ;)

Let's say, you are not one of the 90%, perhaps because

I got you covered (like i had this problems too), so you can configure the way the backup is created with this options:

Define the connection to be backuped

With the first parameter, you can define the connection that is beeing used. You can set the connection within your config/database.php

Define the path to your mysqldump binary

Real world example needed for this option? Ok, short-format: I am using windows ... no more words needed ;)

The second parameter can be used to define a path that points to your mysqldump binary

Hint: When you only need the path to be set, but use your default connection, use mysql as connection name:

Export only the structure

Use the -S option to export only the structure of your database:

Export without options

This is one option that i personally need a lot. For details why, look in the 'How i use it for testing my apps' section.

Export with a date prefix

You can export with the actual date and time as a prefix to the export file name. It will look like 20190425153412_yourConnection.sql. The date format is YmdHis.

Glueing it all together

All glued together (export a specific database, with a custom path, structure only with no options in it):

Where is my backup?

You will find your backup in

If you set the -S option, it looks like this

When used with -D it will look like

DropTable

With this command you can quickly "emtpy" a given database schema without deleting the schema itself. For short, all tables in the given connection will be deleted.

If you want to use this in an automatic way, you can use the --force option to delete the tables without confirmation (you be warned!).

RestoreDatabase

To restore a backup, simply use

You can provide more options in case you need one of this:

All this options are similar to the ones described in db:backup, so you are able to seamlessly restore a backuped database.

How i use it for testing or bugfixing my apps

When having complex setups for very complex bugs it may happen that you are in need of some very specific database entries you do not want to reproduce all the time.

In this case, i do use this package as a helper for me to bugfix faster.

  1. Create a backup from the database with db:backup.
  2. Rename this backup like the bugticket i have.
  3. Setup my unit-test for this bug in a special group, that is not executed by default.
  4. In my testscript, i do define a testschema.
  5. Before running my tests, execute db:drop-tables on the testschema.
  6. Right after that, execute db:restore <ticketnumber>.

With this, everytime i execute my tests for bugfing my database is reset to this very specific point where i can reproduce the bug and fix it fast.

Finally

... have fun 😉 and be productive with it.


All versions of laravel-artisan-database-helper with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0|^8.1|^8.2|^8.3
illuminate/support Version ^6|^7|^8|^9|^10|^11
illuminate/console Version ^6|^7|^8|^9|^10|^11
symfony/process Version ^4.2|^5|^6|^7
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 spresnac/laravel-artisan-database-helper contains the following files

Loading the files please wait ....