Skip to content

docs(laravel): match code generators to lettr-laravel 2.7.0 - #72

Merged
voj-tech-j merged 3 commits into
mainfrom
docs/laravel-codegen-fixes
Sep 19, 2026
Merged

voj-tech-j merged 3 commits into
mainfrom
docs/laravel-codegen-fixes

Conversation

@voj-tech-j

@voj-tech-j voj-tech-j commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Summary

The Laravel Type Safety and Templates pages described generated code that the package never produced: DTOs with snake_case properties and a toArray() that drops nulls, a Mailable built in build(). The Templates page also documented a $template->mergeTags property that TemplateDetail doesn't have. lettr-com/lettr-laravel#20 also changes what the generators output and how they behave.

Every code sample is now real output from the generators on that branch. The docblocks were printed by the generator itself, so they match word for word.

Ready to merge. lettr-laravel#20 shipped in 2.7.0 (tag v2.7.0), so everything described here is released. The page carries a note that it describes 2.7.0 and later, for anyone still on 2.6.x.

Changes

quickstart/laravel/type-safety.mdx

  • Template Enum: real output, including the generated-file docblock, plus a table of naming rules: welcome-emailWelcomeEmail, 2fa-codeTemplate2faCode, classClassTemplate.
  • Template DTOs:
    • the real final readonly class … implements Arrayable shape, with camelCase properties
    • how keys that differ only in case are handled, class names for reserved words, and templates that get skipped
    • --template / --dry-run, and an unknown --template exiting with a failure code
  • Loops (new): the item DTO, and an optional loop left out.
  • Mailable Classes:
    • a table of the two kinds: Blade (default) vs Lettr template (--as-html / --skip-templates), and where each one's subject comes from
    • full samples of both
    • a new Re-running the Command section on the overwrite warning
  • Keeping Code in Sync: generated classes are marked and Pint-clean; stale DTOs aren't deleted.
  • Configuration: adds html_path and blade_path, relative paths, fallback to defaults for keys left out, and the PSR-4 autoload warning.
  • Commands reference: a new option table.
  • Examples: sendTemplate() now takes the DTO directly, since it implements Arrayable.

quickstart/laravel/templates.mdx

  • lettr:pull options: adds --skip-templates and --dry-run, plus how merge tags and loops convert to Blade (@foreach($items ?? [] as $item) with $item['name']).
  • lettr:push: without --path it looks in blade_path first; a relative --path resolves against the project root.
  • Get a template: replaces the non-existent $template->mergeTags with Lettr::templates()->getMergeTags().

Verified against the release

Every sample was re-checked against files generated by the released 2.7.0 in a plain Laravel app (example-new-laravel, 138 templates): the enum, DTO and both Mailable kinds match the generated output, docblock wording included. That run produced 138 enum cases, 37 DTOs and 117 Mailables with 117 views, all of which load, render and pass Pint.

Test Plan

  • mintlify broken-links passes. It passed locally.
  • Open /quickstart/laravel/type-safety in the Mintlify preview. Check that the two tables and the code samples render, and that the #mailable-classes anchor still works: sending-emails.mdx links to it.
  • Open /quickstart/laravel/templates and check the pull/push option lists and the merge tag example.
  • Spot-check a sample against real output: on lettr-laravel#20, run php artisan lettr:generate-dtos --template=<slug> in a Laravel app and compare with the Template DTOs sample.

🤖 Generated with Claude Code

Type Safety and Templates described generated code the package never
produced (snake_case DTO properties, a toArray() that drops nulls, a
build()-based Mailable) and a mergeTags property TemplateDetail doesn't have.
Samples are now real generator output, and the pages cover the behaviour
lettr-laravel#20 adds.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@voj-tech-j voj-tech-j changed the title docs(laravel): match code generators to lettr-laravel#20 docs(laravel): match code generators to lettr-laravel 2.7.0 Sep 19, 2026
@voj-tech-j
voj-tech-j merged commit 174ad00 into main Sep 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant