michael4d45 / laravel-model-schema
Native CLI that reports drift between Laravel migrations, Eloquent models, and Filament forms
Package info
github.com/Michael4d45/Laravel-Model-Schema
Language:Rust
pkg:composer/michael4d45/laravel-model-schema
Requires
- php: ^8.3
- composer-runtime-api: ^2.2
Requires (Dev)
None
Suggests
- ext-curl: Faster GitHub release downloads for vendor/bin/model-schema
Provides
None
Conflicts
None
Replaces
None
README
Report drift between Laravel migrations, Eloquent models, and Filament resource forms.
Analysis runs in a native Rust binary (model-schema) using Mago to parse PHP. The Composer package is a thin vendor/bin stub (same shape as Mago): the first run downloads the matching GitHub release archive and caches it. Later runs reuse the cache. There is no Artisan command and no npm package.
composer require --dev michael4d45/laravel-model-schema vendor/bin/model-schema check
If model-schema.toml exists in the working directory it is loaded automatically.
If GitHub's anonymous rate limit blocks the first download (common on shared CI), pass a token:
- run: vendor/bin/model-schema check env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Command
vendor/bin/model-schema check vendor/bin/model-schema check --config model-schema.toml vendor/bin/model-schema check --json-only vendor/bin/model-schema check --output reports/model_schema_report.json
--config/-cTOML or JSON config (defaults to./model-schema.tomlwhen present)--outputJSON report path (defaultreports/model_schema_report.json)--json-onlyprint the actionable report JSON only--schema-jsonoptional live schema dump (skips migration parse)
v1 is report-only. Automatic --fix flags are not included yet.
Configuration
Copy model-schema.example.toml to the project root as model-schema.toml. Every key is optional: file values overlay Laravel defaults (lists and maps merge; ignore.defaults = false replaces built-in ignores).
[ignore] tables = ["telescope_entries"] [ignore.models] fields = ["uuid"] [unignore] tables = ["jobs"] [[ignore.rules]] tables = ["users"] fields = ["remember_token"] checks = ["filament"]
[ignore]/[ignore.filament|models|phpdoc]skip tables or fields[unignore]re-enables a default skip[[ignore.rules]]scopes a field to specific tables and checks[checks]can turn offfilament,models, orphpdocentirely[models],[filament],[migrations], and*_mappingsextend parser vocabulary
Releases
Tag a Cargo version with a v prefix. Cargo.toml 0.1.0 → git tag v0.1.0.
CI publishes archives named like Mago's rustc triples:
model-schema-0.1.0-x86_64-unknown-linux-musl.tar.gz
model-schema-0.1.0-x86_64-unknown-linux-gnu.tar.gz
model-schema-0.1.0-aarch64-unknown-linux-musl.tar.gz
model-schema-0.1.0-aarch64-unknown-linux-gnu.tar.gz
model-schema-0.1.0-aarch64-apple-darwin.tar.gz
model-schema-0.1.0-x86_64-apple-darwin.tar.gz
vendor/bin/model-schema detects arch + libc (musl vs gnu, so Lerd/Alpine gets musl), downloads that archive from releases/download/v{version}/, and extracts it next to the stub.
Local path installs also look at target/<triple>/release from cargo build, so you do not need a GitHub release while developing.
cargo build --release --target x86_64-unknown-linux-musl # Lerd / Alpine cargo build --release # host glibc
Override with MODEL_SCHEMA_BIN if you want a specific executable.
License
MIT