tey / mod
Lightweight toolkit for modular development in Laravel, for you and your coding agents. Choose or extend common layouts like DDD and modular monoliths, or create your own.
Fund package maintenance!
Requires
- php: ^8.3
- laravel/framework: ^12.0|^13.0
- symfony/filesystem: ^7.2|^8.0
Requires (Dev)
- inertiajs/inertia-laravel: ^2.0|^3.0
- larastan/larastan: ^3.0
- laravel/boost: ^2.10.3
- laravel/mcp: ^1.0
- laravel/pint: ^1.21
- nunomaduro/collision: ^8.0
- orchestra/testbench: ^10.6|^11.0
- pestphp/pest: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^2.0
- phpstan/phpstan-phpunit: ^2.0
Suggests
- lorisleiva/laravel-actions: Used by mod:action when installed
- spatie/laravel-data: Used by mod:dto when installed
- spatie/laravel-view-models: Used by mod:view-model when installed
Provides
None
Conflicts
None
Replaces
None
- dev-main
- 0.6.x-dev
- v0.6.1
- v0.6.0
- v0.5.1
- v0.5.0
- v0.4.1
- v0.4.0
- v0.3.1
- v0.3.0
- v0.2.0
- v0.1.1
- v0.1.0
- dev-feat/default-name-opus
- dev-release/0.6.1
- dev-readme/showcase-pinning
- dev-feat/default-name-cc
- dev-fix/package-wiring
- dev-docs/agents-md
- dev-feat/survey-tool-high
- dev-feat/survey-tool-cc
- dev-feat/module-assets
- dev-feat/mounted-frontend
- dev-feat/package-pages
- dev-feat/public-stack
- dev-feat/module-connections
- dev-feat/package-routes
- dev-feat/scaffold-stack-stubs
- dev-feat/vendor-scaffolds
- dev-feat/scaffold-warning-codes
- dev-fix/recognize-inertia-wiring
- dev-docs/roadmap
- dev-feat/module-translations
- dev-docs/changelog-0.5
- dev-fix/installed-mcp-generators
- dev-docs/model-move-data-review
- dev-fix/custom-inertia-wiring
- dev-fix/inertia-page-entry
- dev-fix/inertia-page-namespaces
- dev-fix/short-boost-guideline
- dev-fix/module-file-type-guidance
This package is auto-updated.
Last update: 2026-10-11 22:46:27 UTC
README
Mod: Modular Development Toolkit for Laravel
Mod is a lightweight toolkit for modular development in Laravel, for you and your coding agents.
Laravel lets you organize your app however you like. Mod makes that easy without fighting the framework: start from Laravel's defaults, adopt patterns from modular or domain-driven designs where they help, and keep Laravel's own make:* commands and conventions throughout.
Created by Jasper Tey, building on the lessons from laravel-ddd and generalized for the many different ways developers and their agents organize growing Laravel applications.
Note
Mod is pre-1.0. Minor releases may change the API until 1.0.
- Six built-in layouts, including modular monolith and DDD, or your own
- Laravel's own generators for every file type, writing into your layout, with related files alongside
- Templates and scaffolds: turn your own patterns into commands, then rename a whole cluster when the feature changes
- Auto-discovery of providers, commands, listeners, migrations, factories and policies
- Agent-friendly: your structure lives in code, so coding agents can look it up and preview every write. See Working with AI agents.
The full documentation is at mod.teylabs.com.
Installation
Mod requires PHP 8.3+ and Laravel 12 or 13.
composer require tey/mod php artisan vendor:publish --tag=mod-config
Quick Start
Choose a layout in config/mod.php:
// config/mod.php 'layout' => 'modules',
Generate a model with its migration and factory, then migrate:
php artisan mod:model Knowledge:Document -mf
php artisan migrate
# -> runs 2026_10_08_120000_create_documents_table from app/Modules/Knowledge/Database/Migrations
What Mod Does
| Try it | Learn more | |
|---|---|---|
| Layouts | 'layout' => 'modules' in config/mod.php |
Layouts |
| Generators | mod:model Knowledge:Document --all |
Generating files |
| Auto-discovery | providers, commands, listeners, migrations, factories and policies, found wherever they live | Auto-discovery |
| Your own generators | mod:template tool, then mod:tool Knowledge:Search |
Custom generators |
| Scaffolds | several related files from one recipe | Scaffolds |
| Module routes and views | Mod::routes(), view('knowledge::documents.show') |
Routes |
| Renames | mod:rename Knowledge:Document Knowledge:Article |
Renaming |
Working with AI Agents
Conventions written in a prompt drift as an app grows. Mod keeps your structure in code, where coding agents can ask for it:
php artisan mod:list --jsontells an agent where every kind of file goes.- Every command that writes files previews its plan with
--dry-run --json. - Mod ships a Laravel Boost guideline, skill and read-only MCP tools. Run
php artisan boost:installand choosetey/mod.
The tools are mod-inventory for configured placement, mod-plan for a command preview, and mod-survey for the app's actual structure. Call mod-survey with no arguments. It reports all classes by file type, folder and namespace, unplaced paths, class/page/route/policy references, recurring file sets, naming patterns, vendor-owned references and Git identity. It falls back to the laravel layout when none is configured.
For example, part of a survey can look like:
{
"references": [{"from": "App\\Http\\Controllers\\WidgetController", "kind": "import", "to": "App\\Models\\Widget"}],
"unplaced": {"count": 1, "paths": ["notes.txt"]}
}
The survey reads only base_path() and its local Git metadata. It rejects path arguments and skips discovered symlinks, .env*, storage/, keys, logs and databases, and uses vendor/ only to classify referenced classes. It returns structure, never file contents; it writes nothing and makes no network calls. See the survey contract and limits. Files larger than 1 MiB (1,048,576 bytes) are skipped before reading; skipped lists their relative paths with size-limit, and links with symlink. bootstrap/cache, public/build, public/hot and public/storage are excluded.
See Agents.
FAQ
Can I Add Mod to an Existing App?
Yes. Mod doesn't move existing files, and make:* keeps working. Start on the laravel layout and switch when you're ready.
When to Choose Mod over the Alternatives
There are several good ways to organize a Laravel app. Pick by what you need:
- nwidart/laravel-modules: modules you can switch on and off, each with its own config and assets. The most established option.
- InterNACHI/modular: each module as its own Composer package, close to plain Laravel, with Blade components and translations loaded per module.
- laravel-ddd: mod's precursor, for domain-driven design with nothing else to learn. Mod's
dddlayout keeps the same folders if you outgrow it. - Mod: your own structure, whether feature folders, vertical slices, DDD, a modular monolith or a mix, with Laravel's own
make:*, generators for your team's patterns, and a structure your coding agents can read.
Mod isn't the right fit yet if you need a stable 1.0 API, per-module translations or assets, or modules you can switch on and off at runtime.
Documentation
Everything else, including configuration, production caching and the command reference, is at mod.teylabs.com.
Testing
composer test
composer analyse
composer lint
Changelog
See CHANGELOG for what has changed recently.
Contributing
See CONTRIBUTING. Questions and ideas go to Discussions.
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.