Mod is pre-1.0. Minor releases may change the API until 1.0.
Skip to content

Upgrading ​

From 0.5 to 0.6 ​

Unprefixed package registration is refused with vendor_required. Replace Mod::scaffold('pages', $recipe) with Mod::vendor('acme')->scaffold('pages', $recipe), and Mod::scaffolds($recipes) with Mod::vendor('acme')->scaffolds($recipes). Update command calls from mod:pages to mod:acme/pages, and include, override and rename references from pages to acme/pages. App registrations keep their existing names.

This is the one breaking change in 0.6. Connection declarations, package routes/pages, mounted-root frontends, assets and structured warning fields are opt-in or additive. Rebuild discovery caches after moving directories, rerun frontend installation after changing declarations, and tolerate new inventory and warning fields.

In 0.3.1, ddd again matches laravel-ddd: application classes use Controllers/, Requests/ and Middleware/ directly under app/Modules/<Domain>. The preset declares no frontend paths, view namespaces or routes root. Extend it with ->frontend(...) and ->mounts('routes', null, ...) to opt in. Existing files stay where they are.

0.2 renames the Layout API outright. Update layout declarations, config keys and exception imports before upgrading an app that customizes mod.

Upgrading to 0.3 ​

HTTP classes (controllers, requests, middleware, resources) in module and feature layouts now live under Http/

Renamed in 0.2 ​

0.10.2
root()mounts()
kind()generates()
relation($id, from: ..., to: ...)relates($from, $to, as: $id); omit as: for the usual <from>-<to> id
exclude()excludes()
typeFolders()path() with a project-relative group path
placementOption()removed; the token in path() names the option
Tey\Mod\Layout\KindTey\Mod\Layout\FileType in using: callbacks
Tey\Mod\Exceptions\UnknownKindTey\Mod\Exceptions\UnknownFileType
GeneratedBase::inKindRoot()GeneratedBase::inFileTypeRoot()
discovery.kindsdiscovery.file_types

Compiled-layout reads such as hasKind(), kind() and kinds() and the generator's protected kind() hook keep their names. The table covers the renamed builder API and public identifiers.

Before ​

A 0.1 declaration adds a file type and customizes a model's factory relation:

app/Providers/AppServiceProvider.phpboot()
php
use Tey\Mod\Facades\Mod;

Mod::layout('modules')
    ->kind('validator', in: 'Modules/{module}/Validators', suffix: 'Validator')
    ->relation('model-factory', from: 'model', to: 'factory')
    ->placementOption('area');

After ​

The group path now names the placement token:

app/Providers/AppServiceProvider.phpboot()
php
use Tey\Mod\Facades\Mod;

Mod::layout('modules')
    ->generates('validator', in: 'Modules/{module}/Validators', suffix: 'Validator')
    ->relates('model', 'factory')
    ->path('app/Modules/{area}');
bash
php artisan mod:validator Knowledge:Upload
# -> app/Modules/Knowledge/Validators/UploadValidator.php

The option is --area; Knowledge:Upload and --in=Knowledge still work. Generator templates use @area and {{ area }}. Custom layouts explains inherited token names and moved paths.

Change the discovery map's key from kinds to file_types, retaining its entries. Run php artisan mod:clear to remove an old discovery cache, then rebuild with php artisan mod:cache during deployment. For paths outside the app's autoload mappings, run php artisan mod:autoload.

Released under the MIT License. Created by Jasper Tey.