PHP code example of cxuan1225 / sql-laravel-schema-converter
1. Go to this page and download the library: Download cxuan1225/sql-laravel-schema-converter library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
cxuan1225 / sql-laravel-schema-converter example snippets
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('email', 255);
$table->timestamps();
$table->unique('email', 'users_email_unique');
});
bash
php artisan schema:convert-sql dump.sql database/migrations --pk=laravel
bash
node bin/sql-laravel.js convert dump.sql generated.php --pk=laravel
bash
php artisan schema:convert-sql {sql_path} {output_path?}
bash
php artisan schema:convert-sql dump.sql database/migrations --pk=laravel
php artisan schema:convert-sql dump.sql database/migrations/2026_05_06_000000_imported_schema.php --foreign-id
php artisan schema:convert-sql dump.sql --no-wrap --json
json
{
"code": "\n\nuse Illuminate\\Database\\Migrations\\Migration;\n...",
"blocks": [
{
"table": "users",
"definitions": []
}
],
"warnings": [],
"blocked": false
}
bash
php tests/php_converter_test.php