shibuyakosuke/laravel-ddl-export

Export Table definition to spreadsheet by artisan command.
13,952 11
Install
composer require shibuyakosuke/laravel-ddl-export
Latest Version:v0.4.0
PHP:^7.4 | ^8.0 | ^8.1 | ^8.2
License:MIT
Last Updated:Aug 25, 2025
Links: GitHub  ·  Packagist
Maintainer: ShibuyaKosuke

laravel-ddl-export

Laravel プロジェクトから、テーブル定義書を xlsx 形式でエクスポートします!

Export Table definition to spreadsheet by artisan command.

For MySQL, PostgreSQL

Install

$ composer require shibuyakosuke/laravel-ddl-export

Usage

Write your migration file with comments. To add table comment, use this library.

<?php

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

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->id()->comment('ID');
            $table->string('name')->comment('氏名');
            $table->string('email')->unique()->comment('メールアドレス');
            $table->timestamp('email_verified_at')->nullable()->comment('メール認証日時');
            $table->string('password')->comment('パスワード');
            $table->rememberToken()->comment('リメンバートークン');
            $table->dateTime('created_at')->nullable()->comment('作成日時');
            $table->dateTime('updated_at')->nullable()->comment('更新日時');
            $table->softDeletes()->comment('削除日時');
            $table->tableComment('ユーザー');
        });
    }
};

Run migration before exporting.

$ php artisan migrate
$ php artisan ddl:export

Export validation rules

$ php artisan ddl:rules

output to /config/rules.php

return [
    'users' => [
        'id' => ['integer', 'required'],
        'name' => ['string', 'required', 'max:255'],
        'email' => ['string', 'required', 'max:255'],
        'email_verified_at' => ['date', 'nullable'],
        'password' => ['string', 'required', 'max:255'],
        'remember_token' => ['string', 'nullable', 'max:100'],
        'created_at' => ['date', 'nullable'],
        'updated_at' => ['date', 'nullable'],
        'deleted_at' => ['date', 'nullable'],
    ],
];

Export translation file

$ php artisan ddl:trans

output to /resources/lang/ja/columns.php

return [
    'users' => [
        'id' => 'ID',
        'name' => '氏名',
        'email' => 'メールアドレス',
        'email_verified_at' => 'メール認証日時',
        'password' => 'パスワード',
        'remember_token' => 'リメンバートークン',
        'created_at' => '作成日時',
        'updated_at' => '更新日時',
        'deleted_at' => '削除日時',
    ],
];

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

641,106,524 9,700
laravel/framework

The Laravel Framework.

593,882,149 34,959
laravel/tinker

Powerful REPL for the Laravel framework.

502,645,077 7,441
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

418,291,778 609
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

394,964,158 4,660

Version History

Version Released PHP Laravel License
v0.4.0 ^7.4 | ^8.0 | ^8.1 | ^8.2 7.30.4 | ^8.0 | ^9.0 | ^10.0 | ^11.0 | ^12.0 MIT
v0.3.3 ^7.4 | ^8.0 | ^8.1 | ^8.2 7.30.4 | ^8.0 | ^9.0 | ^10.0 | ^11.0 MIT
v0.3.2 ^7.4 | ^8.0 | ^8.1 | ^8.2 7.30.4 | ^8.0 | ^9.0 | ^10.0 | ^11.0 MIT
v0.3.1 ^7.4 | ^8.0 | ^8.1 7.30.4 | ^8.0 | ^9.0 | ^10.0 MIT
v0.3.0 ^7.4 | ^8.0 | ^8.1 7.30.4 | ^8.0 | ^9.0 | ^10.0 MIT