Skip to content

v0.5.2 - dot notation for the module

Choose a tag to compare

@Synerdy Synerdy released this 31 Aug 10:02
· 14 commits to master since this release

Separate the module with a dot, the way Laravel writes a view

A view is blog.create in Laravel's own documentation — all lower case, dots throughout. modsx:make wanted the module separated with a slash, and typing the natural form got an error about backslashes, which is unhelpful advice to someone who typed a dot.

The module now ends at the first /, \ or ., whichever comes first:

php artisan modsx:make view blog.create        # -> make:view modsx-blog/create
php artisan modsx:make view blog.admin.index   # -> make:view modsx-blog/admin.index
php artisan modsx:make config blog.services    # -> make:config modsx-blog-services
php artisan modsx:make controller Blog/PostController

Only the first separator divides — a module name can contain none — so the rest of the name keeps its own dots. Strictly additive: every existing test passed unchanged.

The output was never wrong. make:view does str_replace(['\\', '.'], '/', $name) itself, which makes modsx-blog/create and modsx-blog.create the same view. It was the input that was too narrow.

Every generator, documented

The modsx:make section now lists every generator Laravel ships, written as the call you would make through Modsx, with the name each one receives — read off real runs rather than reasoned about:

  • 28 generators take PascalCase and fall under *ModsxBlog/UserController
  • three have a form of their own: view (view path), config (kebab-case), migration (snake_case)
  • six *-table generators take no name at all — they are framework scaffolds, not anything belonging to a module

Either separator works at every one of them.

The one departure from plain Laravel

A config name is snake_case to make:config. Modsx gives it kebab-case, and has to: config/modsx_blog_services.php would not be recognised as the module's file — the rule looks for the modsx- kebab prefix — so the config would be orphaned, backed up with nothing and removed with nothing.

Tests

Assertions moved from what the command prints to where the file actually lands, across every documented form. Two of them had only been passing by accident: Testbench resolves view.paths before the base path moves, so make:view had been writing into vendor/, and make:model only uses app/Models when that directory exists.


Full detail in the CHANGELOG.