PHPackages                             dotted-ai/laravel-db-introspector - 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. dotted-ai/laravel-db-introspector

ActiveLibrary[Database &amp; ORM](/categories/database)

dotted-ai/laravel-db-introspector
=================================

Generate migrations from existing database schema

01.6k↓38.9%PHP

Since Jul 8Pushed 10mo agoCompare

[ Source](https://github.com/dotted-ai/laravel-db-introspector)[ Packagist](https://packagist.org/packages/dotted-ai/laravel-db-introspector)[ RSS](/packages/dotted-ai-laravel-db-introspector/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel DB Introspector
=======================

[](#laravel-db-introspector)

A Laravel package to inspect an existing database schema and generate corresponding migration files automatically.

---

🚀 Installation
--------------

[](#-installation)

1. Require via Composer:

    ```
    composer require dotted-ai/laravel-db-introspector
    ```
2. Publish the stub template (optional):

    ```
    php artisan vendor:publish \
        --provider="Vendor\DbIntrospector\DatabaseInspectorServiceProvider" \
        --tag=stubs
    ```

🎯 Usage
-------

[](#-usage)

Run the artisan command to generate migrations:

```
php artisan db:generate-migrations \
    [--tables=users,posts] \
    [--rewrite] \
    [--output-dir=from_schema]
```

- `--tables=` **(optional)**: Comma-separated list of tables. If omitted, all tables are processed.
- `--rewrite` **(optional)**: Overwrite existing migration files instead of skipping.
- `--output-dir=` **(optional)**: Specify a subdirectory under `database/migrations` to place generated files.

### Examples

[](#examples)

- Generate migrations for all tables, skip existing:

    ```
    php artisan db:generate-migrations
    ```
- Generate only `users` and `posts`, overwrite any existing:

    ```
    php artisan db:generate-migrations --tables=users,posts --rewrite
    ```
- Output migrations to `database/migrations/from_schema`:

    ```
    php artisan db:generate-migrations --output-dir=from_schema
    ```

⚙️ Configuration
----------------

[](#️-configuration)

You can customize the stub template located at `database/stubs/db-introspector/migration.stub` after publishing.

The stub uses placeholders:

- `{{class}}` — migration class name
- `{{table}}` — table name
- `{{fields}}` — column definitions

🛠️ How It Works
---------------

[](#️-how-it-works)

1. **Introspection**: Uses Doctrine DBAL to list tables and columns.
2. **Build**: Maps Doctrine column types to Laravel schema methods.
3. **Generate**: Writes migration files with timestamps to avoid naming conflicts.

📄 License
---------

[](#-license)

MIT © Your Company

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity14

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/daf3ae1a09d0082449e5018d6e3ac1db411340b39c38ff9015dfaf3b76b46b8d?d=identicon)[puppe1990](/maintainers/puppe1990)

---

Top Contributors

[![puppe1990](https://avatars.githubusercontent.com/u/8432835?v=4)](https://github.com/puppe1990 "puppe1990 (7 commits)")

### Embed Badge

![Health badge](/badges/dotted-ai-laravel-db-introspector/health.svg)

```
[![Health](https://phpackages.com/badges/dotted-ai-laravel-db-introspector/health.svg)](https://phpackages.com/packages/dotted-ai-laravel-db-introspector)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90440.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)[wildside/userstamps

Laravel Userstamps provides an Eloquent trait which automatically maintains `created\_by` and `updated\_by` columns on your model, populated by the currently authenticated user in your application.

7511.7M13](/packages/wildside-userstamps)

PHPackages © 2026

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