Download the PHP package cxuan1225/sql-laravel-schema-converter without Composer
On this page you can find all versions of the php package cxuan1225/sql-laravel-schema-converter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download cxuan1225/sql-laravel-schema-converter
More information about cxuan1225/sql-laravel-schema-converter
Files in cxuan1225/sql-laravel-schema-converter
Package sql-laravel-schema-converter
Short Description Convert MySQL or MariaDB CREATE TABLE SQL into Laravel migration schema code.
License MIT
Informations about the package sql-laravel-schema-converter
SQL Laravel Schema Converter
Convert MySQL or MariaDB CREATE TABLE statements into Laravel migration code.
Use this when you have an existing SQL dump and want a faster starting point for Laravel migrations. The converter can run as an npm CLI, Laravel Artisan command, browser tool, or Vercel API. The npm and Composer package contents are kept separate so each installation gets only the files it needs.
Quick Start
Node CLI
Install the standalone CLI:
Convert a SQL dump into a Laravel migration file:
Print generated PHP to stdout instead:
Laravel Artisan
Install the Laravel package:
Convert a SQL dump from inside a Laravel application:
When the output path is a directory, the CLI and Artisan command create a Laravel-style migration filename automatically.
Example
Input SQL:
Command:
Output excerpt:
What It Converts
- One or more MySQL/MariaDB
CREATE TABLEblocks. - Columns, nullable/default modifiers, primary keys, unique keys, indexes, and foreign keys.
created_atandupdated_atcolumns into$table->timestamps().deleted_atcolumns into$table->softDeletes().- Optional
bigint unsignedforeign key columns into$table->foreignId(). - Optional anonymous Laravel migration class wrappers.
- Optional Laravel database connection names through
Schema::connection(...).
The converter also detects warnings, SQL size, table names, foreign keys, and conversion status while editing in the browser UI.
Safety Checks
By default, conversion is blocked when the input contains CRUD or data statements such as SELECT, INSERT, UPDATE, DELETE, or REPLACE. Use --ignore-crud when you want those statements skipped instead.
Foreign key constraints are moved into a second migration pass so referenced tables can be created first.
Installation From GitHub
If the packages have not been published to npm or Packagist yet, install directly from GitHub.
Composer uses composer require to download a package into a Laravel project. composer install is only for installing dependencies from an existing composer.lock.
Node CLI Reference
Run the converter directly from the repository:
Write to a migration directory:
Available CLI options:
Laravel Artisan Reference
The Composer package registers this command in Laravel applications:
Examples:
The Artisan command supports the same conversion options as the Node CLI.
Browser Usage
Open sql_to_laravel_schema_creator.html in a browser.
No build step is required. The page loads Tailwind CSS from the CDN and uses the local files in assets/.
The browser app supports importing .sql or .txt files, pasting from the clipboard, copying output, and downloading the generated migration.
API Usage
Deploy the repository on Vercel and send JSON to:
Example request:
Example response shape:
Package Contents
The repository keeps the browser app, Vercel API, Node CLI, and Laravel package together, but published package contents are separated:
- The npm package includes only the JavaScript converter core, Node CLI, README, and license.
- The Composer package includes only the PHP converter, Laravel Artisan command, service provider, README, and license.
- The Vercel API is deployed from the repository and shares the JavaScript converter core without depending on browser files.
- Browser-only files such as
sql_to_laravel_schema_creator.htmlandassets/are excluded from both CLI package archives.
Deployment
This repository is ready for static deployment on Vercel. The vercel.json file rewrites / to sql_to_laravel_schema_creator.html, so the browser converter is available at the site root after deployment.
Project Structure
Verification
Run JavaScript syntax checks:
Run the JavaScript converter/API/CLI tests:
Validate Composer metadata:
Run the PHP converter smoke test:
Conversion Notes
This is a practical converter, not a full SQL parser or database engine. Always review the generated migration before running it, especially for:
- indexes and composite keys
- foreign key actions
- enum values
- decimal precision
- generated columns
- check constraints
- default expressions
- legacy zero-date values
The converter is designed to accelerate migration drafting while keeping final schema review in the developer's hands.
AI-Generated Content Notice
This project was generated with assistance from AI tools. It may contain mistakes, incomplete behavior, security issues, or misleading documentation. Users are solely responsible for reviewing, testing, and validating all code before use, especially in production environments. The repository owner, contributors, and any referenced authors make no warranties and accept no liability for errors, omissions, or any consequences arising from the use of this project. This notice is supplementary to and does not modify the terms of the MIT License.
License
MIT
All versions of sql-laravel-schema-converter with dependencies
illuminate/console Version ^10.0|^11.0|^12.0|^13.0
illuminate/support Version ^10.0|^11.0|^12.0|^13.0