You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
💡 Let a plugin override the make:* stubs, like Laravel's stub:publish #133
Every make:* command fills a stub from the framework, and only from there: prepareStub() calls getStubContent(), which reads vendor/wpbones/wpbones/src/Console/stubs/{name}.stub (src/Console/bin/bones 3521 and 1536–1539 at v3.0.0). A team that wants its generated controllers, providers or migrations to follow its own conventions can only edit vendor/, and the next composer update puts the framework's stubs back.
Generators never overwrite an existing file; --force goes on each call (since 2.0.10).
A custom command (php bones make:console) can generate anything from the team's own templates, and php bones lists it under Extensions. The built-in make:* commands keep the framework's stubs.
Proposal, after Laravel's stub:publish
getStubContent() looks for stubs/{name}.stub in the plugin's root first and falls back to the framework's. Every make:* command goes through prepareStub(), so one change covers all of them.
php bones stub:publish [name ...] copies the framework's stubs into stubs/, without overwriting unless --force, like the generators.
deploy leaves stubs/ out of the build, as its skip list already does for the framework's own stubs folder (bones 2564).
To settle first
Once a stub can be overridden, its placeholders ({Namespace}, {ClassName}, {Path}, ...) are a public contract: they need documenting per stub, and a rename becomes a breaking change.
A published stub stops following the framework's: say so in the docs, and maybe have php bones warn when a published stub is older than the framework's copy.
Activity
gfazioli commentedon Oct 7, 2026
Shipped in v3.1.0 (#134): every
make:*command readsstubs/{name}.stubfrom the plugin first,php bones stub:publish [<stub> ...] [--force]copies the framework's stubs there, anddeployleaves them out. The placeholders of each stub are listed in the docs: https://wpbones.com/docs/bones-console/bones-console#customizing-the-stubs