npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

laravel-schemify

v1.0.4

Published

Reverse-engineer a MySQL or PostgreSQL database into Laravel migration files — interactive CLI

Readme

laravel-schemify

Instantly generate Laravel migration files from your existing MySQL or PostgreSQL database — no config files, just answer a few prompts.

CI npm version node license


The Problem

A new developer joins your Laravel project. There are no migrations — just a live database nobody documented. Setting up locally means manually recreating dozens of tables from scratch.

laravel-schemify solves this. Run one command, answer a few prompts, and every table in your database becomes a proper Laravel migration file ready for php artisan migrate.


Installation

Install globally and use it in any Laravel project:

npm install -g laravel-schemify

Or use it once without installing:

npx laravel-schemify

Or add it as a dev dependency to a specific project:

npm install --save-dev laravel-schemify
npx laravel-schemify

Usage

Run from the root of your Laravel project:

laravel-schemify

The CLI walks you through everything interactively:

  laravel-schemify

  Generate Laravel migrations from your existing database.

  Found .env file — mysql://[email protected]:3306/my_app
  ? Use database config from .env file? › Yes

  Migration output options:
  ? Output directory › ./database/migrations
  ? Tables to include (comma-separated, leave blank for ALL) ›
  ? Overwrite existing migration files? › No

  ✔ Connected to my_app via mysql
  ✔ Found 12 table(s): users, posts, comments, ...

  ✔ Generated: 2026_04_03_120000_create_users_table.php
  ✔ Generated: 2026_04_03_120001_create_posts_table.php
  ✔ Generated: 2026_04_03_120002_create_comments_table.php
  ...

  Done! 12 migration(s) written to ./database/migrations

What gets auto-detected from your .env

If a .env file exists in the current directory, laravel-schemify reads DB_CONNECTION, DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME, and DB_PASSWORD automatically — you just confirm or override.


Generated migration example

For a users table in MySQL:

<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('users', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('email');
            $table->timestamp('email_verified_at')->nullable();
            $table->string('password');
            $table->enum('status', ['active', 'inactive', 'banned'])->default('active');
            $table->boolean('is_verified')->default(false);
            $table->unsignedBigInteger('team_id')->nullable();
            $table->timestamps();
            $table->softDeletes();

            $table->unique('email', 'users_email_unique');
            $table->index('team_id', 'users_team_id_index');

            $table->foreign('team_id')->references('id')->on('teams')->onDelete('set null');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('users');
    }
};

What gets handled automatically

| Database pattern | Generated Laravel code | |---|---| | id BIGINT UNSIGNED AUTO_INCREMENT | $table->id() | | created_at + updated_at columns | $table->timestamps() | | deleted_at nullable timestamp | $table->softDeletes() | | UNIQUE indexes | $table->unique(...) | | Composite indexes | $table->index([...]) | | FULLTEXT indexes (MySQL) | $table->fullText(...) | | Foreign key constraints | $table->foreign(...)->references(...)->on(...) | | ON DELETE / ON UPDATE rules | ->onDelete('cascade') etc. | | ENUM columns | $table->enum('col', ['a', 'b']) | | Nullable columns | ->nullable() | | Default values | ->default(...) | | Unsigned integers | ->unsigned() | | Column comments | ->comment(...) |


Supported databases & column types

MySQL / MariaDB

| MySQL type | Laravel method | |---|---| | TINYINT(1) | boolean() | | TINYINT, SMALLINT, MEDIUMINT, INT, BIGINT | tinyInteger(), smallInteger(), mediumInteger(), integer(), bigInteger() | | Auto-increment variants | tinyIncrements(), smallIncrements(), mediumIncrements(), increments(), bigIncrements() | | FLOAT, DOUBLE, DECIMAL | float(), double(), decimal() | | CHAR, VARCHAR | char(), string() | | TINYTEXT, TEXT, MEDIUMTEXT, LONGTEXT | tinyText(), text(), mediumText(), longText() | | BINARY, BLOB variants | binary() | | DATE, DATETIME, TIMESTAMP, TIME, YEAR | date(), dateTime(), timestamp(), time(), year() | | JSON | json() | | ENUM, SET | enum(), set() | | Spatial: POINT, POLYGON, GEOMETRY, etc. | point(), polygon(), geometry(), etc. |

PostgreSQL

| PostgreSQL type | Laravel method | |---|---| | int2/4/8, serial, bigserial | smallInteger(), integer(), bigInteger(), increments(), etc. | | float4, float8, numeric, money | float(), double(), decimal() | | char, varchar, text, citext | char(), string(), text() | | bytea | binary() | | boolean | boolean() | | date, timestamp, timestamptz, time, timetz | date(), dateTime(), dateTimeTz(), time(), timeTz() | | json, jsonb | json(), jsonb() | | uuid | uuid() | | inet, macaddr | ipAddress(), macAddress() | | point, polygon | point(), polygon() | | Arrays (_text, _int4, etc.) | json() |


Requirements

  • Node.js >= 20.0.0
  • Laravel 9+ (uses anonymous class migration syntax)
  • MySQL 5.7+ / MariaDB 10.3+ or PostgreSQL 12+

After generating migrations

# Run all generated migrations
php artisan migrate

# Or preview what will run first
php artisan migrate --pretend

License

MIT © ahsanmster