PHPackages                             jpswade/laravel-database-tools - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. jpswade/laravel-database-tools

ActiveLaravel-package[Database &amp; ORM](/categories/database)

jpswade/laravel-database-tools
==============================

Laravel Database Tools

1.3.0(7mo ago)210.1k1MITPHPPHP ^7.4|^8.0|^8.1|^8.2|^8.3

Since Mar 2Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/jpswade/laravel-database-tools)[ Packagist](https://packagist.org/packages/jpswade/laravel-database-tools)[ RSS](/packages/jpswade-laravel-database-tools/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (7)Versions (5)Used By (0)

Laravel Database Tools
======================

[](#laravel-database-tools)

The "missing" database toolset for Laravel. A set of commonly used Database Tools for Laravel.

With this package you can:

- Create a database (if it does not exist)
- Dump from another database to file
- Get and unzip from a database backup created by the [Spatie Backup package](https://github.com/spatie/laravel-backup)
- Import from file
- Update the charset and collation
- Fixes the "no such function" error by giving SQLite MySQL compatibility by creating the missing function using PDO for SQLite using PHP functions.
- Uses MySQL commands to optimize database tables (using OPTIMIZE TABLE)

Install
-------

[](#install)

Install the package into your Laravel application:

- `composer require --dev jpswade/laravel-database-tools`

Note: It's wise to only install these tools in development by default, as it's rare you should need them in a production environment.

Configure
---------

[](#configure)

Publish and customise your own `dbtools.php` file:

- `php artisan vendor:publish --provider="Jpswade\LaravelDatabaseTools\ServiceProvider" --tag="config"`

This allows you to set the source database and/or filesystem for the backup.

- `dbtools.database` - Define the source database for the `db:dump` command, similar to Laravel databases config.
- `dbtools.filesystem` - Define the source filesystem for the `db:getFromBackup` command, similar to Laravel filesystems config.
- `dbtools.filesystem.path` - Define the path for the `db:getFromBackup` command.
- `dbtools.import` - Here you can define the `method` (command or normal) for the `db:importFromFile` command.

Note:

- The `db:getFromBackup` command falls back to the `spatie/laravel-backup` package for configuration.

Usage
-----

[](#usage)

The commands are:

- `db:create` - Creates the database schema.
- `db:dump` - Fetch a copy of the latest database from the configured server.
- `db:getFromBackup` - Download database backup file from backup.
- `db:importFromFile {file?}` - Import data from a sql file into a database.
- `db:charset` - Changes the charset and collation to whatever the database is set to use.
- `db:optimize` - Optimizes your database tables.

### SQLite MySQL Compatability Provider

[](#sqlite-mysql-compatability-provider)

For `testing` you can add the provider to your Test:

```
    protected function registerServiceProviders(): void
    {
        $this->app->register(SqliteMysqlCompatibilityProvider::class);
    }

    protected function setUp(): void
    {
        parent::setUp();

        $this->registerServiceProviders();
    }
```

In production, follow the usual [Registering Providers](https://laravel.com/docs/9.x/providers#registering-providers) instructions:

In `config/app.php`, find the `providers` array and add:

```
'providers' => [
    // Other Service Providers

    Jpswade\LaravelDatabaseTools\SqliteMysqlCompatibilityProvider::class,
],
```

Limitations
-----------

[](#limitations)

These are limitations you'll come across if you use certain commands:

- The `db:getFromBackup` command relies on the `league/flysystem-aws-s3-v3 "^1.0"` package, when you use the [Amazon S3 Driver](https://laravel.com/docs/5.1/filesystem#configuration) as per the Laravel docs.
- The `db:dump` command depends on `spatie/db-dumper`.
- The commands have only been tested to work with MySQL at the moment, but could be extended to others.
- The `db:importFromFile` command can only import `.sql` files.
- The `db:optimize` command only works with MySQL (at the moment).

Troubleshooting
---------------

[](#troubleshooting)

### Class 'League\\Flysystem\\AwsS3v3\\AwsS3Adapter' not found

[](#class-leagueflysystemawss3v3awss3adapter-not-found)

`% composer require league/flysystem-aws-s3-v3:~1.0`

Note: Needed for `db:getFromBackup` command to use the S3 Driver.

### Class "League\\Flysystem\\AwsS3V3\\PortableVisibilityConverter" not found

[](#class-leagueflysystemawss3v3portablevisibilityconverter-not-found)

`% composer require league/flysystem-aws-s3-v3`

### Class 'Spatie\\DbDumper\\Databases\\MySql' not found

[](#class-spatiedbdumperdatabasesmysql-not-found)

`% composer require spatie/db-dumper`

Note: Needed by the `db:dump` command.

###  Health Score

48

—

FairBetter than 95% of packages

Maintenance78

Regular maintenance activity

Popularity27

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~315 days

Total

4

Last Release

227d ago

PHP version history (4 changes)1.0.0PHP ^7.4|8.0.\*|8.1.\*

1.1.0PHP ^7.4|8.\*

1.2.0PHP ^8.0|^8.1|^8.2|^8.3

1.3.0PHP ^7.4|^8.0|^8.1|^8.2|^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/301eb5e9f2532944470784ea03cfa2b786b425d703a94949653a4352f743a865?d=identicon)[jpswade](/maintainers/jpswade)

---

Top Contributors

[![jpswade](https://avatars.githubusercontent.com/u/1087963?v=4)](https://github.com/jpswade "jpswade (139 commits)")

---

Tags

laraveldatabasebackupsqlitedbtools

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/jpswade-laravel-database-tools/health.svg)

```
[![Health](https://phpackages.com/badges/jpswade-laravel-database-tools/health.svg)](https://phpackages.com/packages/jpswade-laravel-database-tools)
```

###  Alternatives

[spatie/laravel-backup

A Laravel package to backup your application

6.0k21.8M191](/packages/spatie-laravel-backup)[tucker-eric/eloquentfilter

An Eloquent way to filter Eloquent Models

1.8k4.8M26](/packages/tucker-eric-eloquentfilter)[cybercog/laravel-clickhouse

ClickHouse migrations for Laravel

163166.8k](/packages/cybercog-laravel-clickhouse)[toponepercent/baum

Baum is an implementation of the Nested Set pattern for Eloquent models.

3154.7k](/packages/toponepercent-baum)[webparking/laravel-db-rebuild

A laravel package that allows for quick database rebuilds with presets.

448.8k](/packages/webparking-laravel-db-rebuild)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
