PHPackages                             mohamedhekal/laravel-schema-track - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. mohamedhekal/laravel-schema-track

ActiveLibrary[Database &amp; ORM](/categories/database)

mohamedhekal/laravel-schema-track
=================================

Smart Version-Controlled Schema History &amp; Change Logger for Laravel Projects

v1.0.0(9mo ago)10MITPHPPHP ^8.1CI passing

Since Jul 27Pushed 9mo agoCompare

[ Source](https://github.com/mohamedhekal/laravel-schema-track)[ Packagist](https://packagist.org/packages/mohamedhekal/laravel-schema-track)[ RSS](/packages/mohamedhekal-laravel-schema-track/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (10)Versions (2)Used By (0)

📦 Laravel SchemaTrack
=====================

[](#-laravel-schematrack)

**Smart Version-Controlled Schema History &amp; Change Logger for Laravel Projects**

[![Latest Version on Packagist](https://camo.githubusercontent.com/de8401a7da7124e9ae7dedd88ff88a9c7f064aa3b02d8fe0d97e2b4c74e976e8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6f68616d656468656b616c2f6c61726176656c2d736368656d612d747261636b2e737667)](https://packagist.org/packages/mohamedhekal/laravel-schema-track)[![Tests](https://github.com/mohamedhekal/laravel-schema-track/workflows/Tests/badge.svg)](https://github.com/mohamedhekal/laravel-schema-track/actions)[![Total Downloads](https://camo.githubusercontent.com/3f994e8dfe4c5073ab34692579f644b109fbc0a43835c3c8d36609203e540872/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6f68616d656468656b616c2f6c61726176656c2d736368656d612d747261636b2e737667)](https://packagist.org/packages/mohamedhekal/laravel-schema-track)

---

🚀 Overview
----------

[](#-overview)

**Laravel SchemaTrack** is a developer-focused package that brings **schema versioning**, **change tracking**, and **visual diffs** to Laravel's database structure — turning your migrations and database changes into a clear, documented, and reversible timeline.

Think of it as **Git for your database schema**, fully integrated into Laravel.

---

💡 Key Features
--------------

[](#-key-features)

- 🧠 **Auto Snapshot**: Automatically takes a snapshot of your entire database schema after each `migrate` operation
- 🧾 **Schema Diff Viewer**: Shows visual differences between schema versions
- 📚 **Changelog Generator**: Generates Markdown or JSON changelog with human-readable schema changes
- 🌐 **Multi-Environment Compare**: Compare schema state between environments
- 📦 **Custom Artisan Commands**: Complete CLI interface for schema management
- 🛠️ **Schema Explorer Dashboard**: Web UI for browsing schema versions (Optional)
- 🔐 **Safe by Design**: Never alters your schema, only reads metadata

---

📦 Installation
--------------

[](#-installation)

```
composer require mohamedhekal/laravel-schema-track
```

Publish the configuration file:

```
php artisan vendor:publish --provider="MohamedHekal\LaravelSchemaTrack\SchemaTrackServiceProvider"
```

---

🧰 Usage
-------

[](#-usage)

### Basic Commands

[](#basic-commands)

```
# Take a manual snapshot
php artisan schema:track

# View differences between snapshots
php artisan schema:diff --from=2024_07_01 --to=latest

# Compare with another environment
php artisan schema:compare --env=staging

# Generate changelog
php artisan schema:changelog --format=markdown --output=CHANGELOG.md

# List all snapshots
php artisan schema:list
```

### Auto-Snapshot on Migrations

[](#auto-snapshot-on-migrations)

The package automatically takes snapshots after each migration. You can disable this in the config:

```
// config/schema-track.php
'auto_snapshot' => true,
```

---

🧪 Use Case Examples
-------------------

[](#-use-case-examples)

ScenarioValue🏢 Large teamsEnsure developers don't override each other's migration logic🧪 QA testingCommunicate DB changes clearly across versions🕵️ DebuggingQuickly inspect when a schema column was added/changed🚀 CI/CDDetect unintentional or risky schema changes before deployment---

📁 Directory Structure
---------------------

[](#-directory-structure)

```
storage/schema-track/
├── 2024_07_01_123000_initial_snapshot.json
├── 2024_07_10_093000_add_users_table.json
├── ...

```

---

📜 Sample Output
---------------

[](#-sample-output)

### Changelog (Markdown)

[](#changelog-markdown)

```
## 🗂 Schema Changes (2024-07-26)

### Modified Table: `users`
- Added Column: `is_verified` → boolean, default: false
- Changed Column: `email` → now unique

### New Table: `user_profiles`
- `id`, `user_id`, `bio`, `avatar`, timestamps
```

### Diff Output

[](#diff-output)

```
$ php artisan schema:diff --from=2024_07_01 --to=latest

📊 Schema Diff Report
====================

🆕 New Tables:
  - user_profiles

📝 Modified Tables:
  - users:
    + Added: is_verified (boolean, default: false)
    + Changed: email (now unique)
```

---

⚙️ Configuration
----------------

[](#️-configuration)

```
// config/schema-track.php

return [
    'storage_path' => storage_path('schema-track'),
    'auto_snapshot' => true,
    'snapshot_prefix' => 'schema_snapshot',
    'supported_databases' => ['mysql', 'pgsql', 'sqlite'],
    'exclude_tables' => ['migrations', 'failed_jobs'],
    'changelog_formats' => ['markdown', 'json'],
];
```

---

🧠 How It's Better Than Migrations Alone
---------------------------------------

[](#-how-its-better-than-migrations-alone)

Laravel MigrationsSchemaTrackCode-first schemaSnapshot of actual DBDoesn't track change historyTracks every changeManual diffingAuto-diff between any two statesCan become out-of-syncAlways reflects real DB state---

🔮 Roadmap
---------

[](#-roadmap)

- ✅ Auto-generate test cases for schema constraints
- ✅ Slack/Discord notifications on critical changes
- ✅ Integration with Laravel Nova or Filament dashboard
- ✅ Detect risky changes (dropping indexed columns, foreign keys)

---

🧪 Testing
---------

[](#-testing)

```
# Run all tests
composer test

# Run tests with coverage
composer test-coverage

# Run static analysis
composer analyse

# Format code
composer format

# Check code style
composer format-check
```

### Using Makefile

[](#using-makefile)

```
# Setup development environment
make setup

# Run all CI checks
make ci

# Show available commands
make help
```

### Using Docker for Testing

[](#using-docker-for-testing)

```
# Start test databases
docker-compose up -d

# Run tests
composer test
```

---

📄 License
---------

[](#-license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

---

🤝 Contributing
--------------

[](#-contributing)

Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

---

🛠️ Development
--------------

[](#️-development)

### Prerequisites

[](#prerequisites)

- PHP 8.1+
- Composer
- Laravel 10+ or 11+

### Setup

[](#setup)

```
# Clone the repository
git clone https://github.com/mohamedhekal/laravel-schema-track.git
cd laravel-schema-track

# Install dependencies
composer install

# Setup development environment
make setup
```

### Running Tests

[](#running-tests)

```
# Run all tests
make test

# Run tests with coverage
make test-coverage

# Run static analysis
make analyse

# Format code
make format
```

### Contributing

[](#contributing)

Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.

### Prerequisites

[](#prerequisites-1)

- PHP 8.1+
- Composer
- Laravel 10+ or 11+

### Setup

[](#setup-1)

```
# Clone the repository
git clone https://github.com/mohamedhekal/laravel-schema-track.git
cd laravel-schema-track

# Install dependencies
composer install

# Setup development environment
make setup
```

### Running Tests

[](#running-tests-1)

```
# Run all tests
make test

# Run tests with coverage
make test-coverage

# Run static analysis
make analyse

# Format code
make format
```

### Contributing

[](#contributing-1)

Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.

📞 Support
---------

[](#-support)

- 📧 Email:
- 🐛 Issues: [GitHub Issues](https://github.com/mohamedhekal/laravel-schema-track/issues)
- 📖 Documentation: [Wiki](https://github.com/mohamedhekal/laravel-schema-track/wiki)

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance56

Moderate activity, may be stable

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

290d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a9d7c092a109fe780c7efd87ce4142eae2c0cec0f92fd1e87e769bec5661953b?d=identicon)[mohamedhekal](/maintainers/mohamedhekal)

---

Top Contributors

[![mohamedhekal](https://avatars.githubusercontent.com/u/21014387?v=4)](https://github.com/mohamedhekal "mohamedhekal (10 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/mohamedhekal-laravel-schema-track/health.svg)

```
[![Health](https://phpackages.com/badges/mohamedhekal-laravel-schema-track/health.svg)](https://phpackages.com/packages/mohamedhekal-laravel-schema-track)
```

###  Alternatives

[tpetry/laravel-postgresql-enhanced

Support for many missing PostgreSQL specific features

9982.0M14](/packages/tpetry-laravel-postgresql-enhanced)[overtrue/laravel-versionable

Make Laravel model versionable.

585308.0k5](/packages/overtrue-laravel-versionable)[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)[sonata-project/entity-audit-bundle

Audit for Doctrine Entities

644989.8k1](/packages/sonata-project-entity-audit-bundle)[webfactory/slimdump

slimdump is a little tool to help you creating dumps of large MySQL-databases.

188124.8k1](/packages/webfactory-slimdump)[bolt/core

🧿 Bolt Core

585142.5k54](/packages/bolt-core)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
