farzai/laravel-schema
Composer 安装命令:
composer require farzai/laravel-schema
包简介
Visualize and compare database schemas between Laravel migrations and your database
README 文档
README
A Laravel package for visualizing and comparing database schemas. View your database structure through an interactive ER diagram dashboard and identify differences between your migration files and actual database state.
Similar to Laravel Horizon and Telescope, it provides a beautiful web interface for schema inspection. This package is view-only — it detects and visualizes differences but does not generate or apply migrations.
Features
- Interactive ER Diagram — Visualize your database schema with React Flow
- Schema Comparison — Compare migrations vs actual database state
- Multi-Database Support — MySQL, PostgreSQL, SQLite, and SQL Server
- Diff Detection — See added, removed, and modified tables/columns at a glance
- REST API — Programmatic access to schema data
- Gate-based Authorization — Secure access similar to Horizon/Telescope
- Dark Mode — Beautiful dark theme out of the box
Requirements
- PHP 8.4+
- Laravel 11.x or 12.x
Installation
Install the package via Composer:
composer require farzai/laravel-schema
Publish the configuration file:
php artisan vendor:publish --tag=laravel-schema-config
Publish the frontend assets:
php artisan vendor:publish --tag=laravel-schema-assets
Configuration
The configuration file will be published to config/schema.php:
return [ // Subdomain for Laravel Schema (optional) 'domain' => env('SCHEMA_DOMAIN'), // URI path where the dashboard is accessible 'path' => env('SCHEMA_PATH', 'schema'), // Route middleware 'middleware' => ['web'], // Authorization settings 'authorization' => [ 'enabled' => true, 'gate' => 'viewLaravelSchema', ], // Path to migrations directory 'migrations_path' => 'database/migrations', // Database connection (null = default) 'connection' => null, // Tables to ignore during comparison 'ignored_tables' => [ 'migrations', 'password_reset_tokens', 'sessions', 'cache', 'cache_locks', 'jobs', 'job_batches', 'failed_jobs', ], ];
Authorization
By default, Laravel Schema is only accessible in the local environment. To configure access in other environments, define authorization logic in your AppServiceProvider:
use Farzai\LaravelSchema\SchemaInspector; public function boot(): void { SchemaInspector::auth(function ($request) { return app()->environment('local') || in_array($request->user()?->email, [ 'admin@example.com', ]); }); }
Dashboard
Once installed, access the dashboard at:
http://your-app.test/schema
The dashboard provides:
- ER Diagram — Interactive visualization of your database tables and relationships
- Schema Differences — Visual indicators for added, removed, and modified schema elements
- Table Details — Column types, indexes, and foreign key information
- Legend — Color-coded guide for understanding diff status
API Endpoints
Laravel Schema exposes a REST API for programmatic access:
| Method | Endpoint | Description |
|---|---|---|
| GET | /schema |
Dashboard (React SPA) |
| GET | /schema/api/tables |
List all database tables |
| GET | /schema/api/tables/{table} |
Get specific table details |
| GET | /schema/api/diff |
Full schema comparison |
| GET | /schema/api/diff/{table} |
Table-specific diff |
| GET | /schema/api/migrations |
List migration files |
| GET | /schema/api/status |
Schema sync status summary |
| POST | /schema/api/refresh |
Force schema refresh |
Testing
composer test
Run tests with coverage:
composer test-coverage
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.
farzai/laravel-schema 适用场景与选型建议
farzai/laravel-schema 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 01 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「database」 「migrations」 「schema」 「diff」 「laravel」 「visualization」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 farzai/laravel-schema 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 farzai/laravel-schema 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 farzai/laravel-schema 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Dibi is Database Abstraction Library for PHP
Store your language lines in the database, yaml or other sources
Extension for Opis JSON Schema
Symfony ClickhouseMigrationsBundle
Very simple SQL-based database migrations tool - a heavily stripped down fork of robmorgan/phinx
A package for automatically encrypting and decrypting Eloquent attributes in Laravel 5.5+, based on configuration settings.
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 35
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-12
