mkaram / laravel-snap
Granular pattern and feature snapshotting system for Laravel.
v1.3.0
2026-08-19 02:07 UTC
Requires
- php: ^8.0|^8.1|^8.2|^8.3|^8.4
- illuminate/console: ^8.0|^9.0|^10.0|^11.0|^12.0|^13.0
- illuminate/filesystem: ^8.0|^9.0|^10.0|^11.0|^12.0|^13.0
- illuminate/support: ^8.0|^9.0|^10.0|^11.0|^12.0|^13.0
- nikic/php-parser: ^4.18|^5.0
Requires (Dev)
- orchestra/testbench: ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
- pestphp/pest: ^1.0|^2.0|^3.0
README
Granular pattern capture, architectural blueprint scaffolding, dependency-aware transplantation, and native AI MCP engine for Laravel.
💡 Why Laravel Snap?
Moving features between Laravel applications (like Wallet, OTP, Subscription, or Invoicing) is traditionally messy:
- You manually hunt down dozens of scattered files across
app/,database/, andconfig/. - You waste time fixing namespaces, imports, and broken timestamps on migrations.
- You run into
Class not founderrors when third-party packages are missing.
Laravel Snap turns any feature into a portable, dependency-aware architectural blueprint that you can snapshot and install into any target Laravel project in seconds.
✨ Key Features
- 🔍 Deep Multi-Layer Discovery: Recursively scans
Models,Services,Actions,Contracts,DTOs,Events,Controllers,Requests,Resources,Notifications,Jobs,Policies,Rules,Migrations, andConfig. - ⚡ AST-Powered Skeleton Mode (
--skeleton): Uses PHP Abstract Syntax Tree parsing (nikic/php-parser) to strip method bodies while keeping strict return types, docblocks, and properties intact — generating pristine domain interfaces ready for logic implementation. - 📦 Smart Dependency Resolver: Scans imported
usestatements againstinstalled.json, identifies required 3rd-party Composer packages (e.g.stripe/stripe-php), and offers interactive auto-installation during setup. - 🔄 Dynamic PSR-4 Namespace Translation: Tokenizes root namespaces on snapshot and rebinds them dynamically to match the target project's application namespace.
- 🕒 Safe Database Migrations: Automatically recalculates migration timestamps upon installation to ensure correct schema execution order without conflicts.
- 🤖 Native Model Context Protocol (MCP) Server: Seamless
stdiointegration with Cursor, Windsurf, and Claude Code to scaffold patterns right from your AI prompt. - 🐳 Docker & Team-Ready: Zero-config storage path resolution supporting Host OS, Docker containers, and project-level Git repository sharing.
🚀 Installation
Install the package via Composer into your Laravel application:
composer require mkaram/laravel-snap --dev
🛠️ Quick Usage
1. Capture a feature (Source Project):
php artisan snap:pattern wallet --all
📚 Documentation
Full guides live in docs/:
| Guide | Description |
|---|---|
| Introduction | What Laravel Snap is and the problems it solves |
| AST Skeleton Mode | --skeleton blueprints powered by nikic/php-parser |
| Dependency Resolution | How Composer packages travel with a snapshot |
| CLI Reference | snap:pattern, snap:install, and snap:list |
| Cursor & MCP Integration | Native stdio MCP server for Cursor and Windsurf |
