New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

nachopitt/db-commands

Artisan commands for managing databases.
1,032
Install
composer require nachopitt/db-commands
Latest Version:v0.6.0
PHP:^8.2
Laravel:11 · 12 · 13
Older releases:9 · 10
License:MIT
Last Updated:Jul 16, 2026
Links: GitHub  ·  Packagist
Maintainer: nachopitt

DB Commands

A set of Laravel Artisan commands for database management.

Installation

You can install the package via composer:

composer require nachopitt/db-commands

Usage

db:create

Create a new MySQL database.

php artisan db:create {name?} {--c|connection=}
Argument / Option Description
name The name of the MySQL database to create. If not provided, the command will use the database name from your configuration.
--connection The database connection to use (e.g. mysql). Defaults to the active default connection.

db:drop

Drop an existing MySQL database.

php artisan db:drop {name?} {--c|connection=} {--force}
Argument / Option Description
name The name of the MySQL database to drop. If not provided, the command will use the database name from your configuration.
--connection The database connection to use. Defaults to the active default connection.
--force Force the operation to run without prompting for confirmation.

db:export

Export an existing MySQL database into SQL statements.

php artisan db:export {schema?} {--c|connection=} {--skip-ssl}
Argument / Option Description
schema The name of the MySQL database to export. If not provided, the command will use the database name from your configuration.
--connection The database connection to use. Defaults to the active default connection.
--skip-ssl Bypass SSL certificate verification for the mysqldump command.

db:import

Import a SQL file into an existing MySQL database.

php artisan db:import {file?} {--s|schema=} {--i|ignore-foreign-key-checks} {--c|connection=}
Argument / Option Description
file The path to the SQL file to import. If not provided, the command will use database_model/{database}.sql.
--schema The name of the MySQL database to import into. If not provided, the command will use the database name from your configuration.
--ignore-foreign-key-checks Ignore foreign key checks while importing.
--connection The database connection to use. Defaults to the active default connection.

db:truncate

Truncate tables from a MySQL database.

php artisan db:truncate {tables?} {--s|schema=} {--i|ignore-foreign-key-checks} {--c|connection=}
Argument / Option Description
tables A comma-separated list of tables to truncate. If not provided, the command will truncate all tables in the database.
--schema The name of the MySQL database to truncate tables from. If not provided, the command will use the database name from your configuration.
--ignore-foreign-key-checks Ignore foreign key checks while truncating.
--connection The database connection to use. Defaults to the active default connection.

Testing

You can run the automated tests via:

composer test

License

The MIT License (MIT). Please see License File for more information.

Related Packages

crysalead/sql-dialect

SQL query builder.

13,238 6
yavor-ivanov/csv-importer

A CSV importer/exporter library for Laravel

32 6
usmanhalalit/pixie

A lightweight, expressive, framework agnostic query builder for PHP.

2,314,856 674
xve/laravel-db-export

Laravel database export package with profile-based exclusions, anonymization, an...

2,102 0
stolz/laravel-schema-spy

Laravel artisan command that uses JAVA schemaSpy tool to generate a graphical re...

21,820 43

Version History

Version Released PHP Laravel License
v0.6.0 ^8.2 ^11.0|^12.0|^13.0 MIT
v0.5.0 ^8.2 ^11.0|^12.0|^13.0 MIT
v0.4.2 ^9.0|^10.0|^11.0|^12.0 MIT
v0.4.1 ^9.0|^10.0|^11.0|^12.0 MIT
v0.4.0 ^9.0|^10.0|^11.0|^12.0 MIT