Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Template Laravel Package

lukeraymonddowning/laravel-template

Laravel Template by Luke Downing offers a clean, class-based way to define and render reusable Blade templates. Encapsulate template data and presentation logic in dedicated objects, making emails, PDFs, reports, and other generated content easier to manage.

View on GitHub
Deep Wiki
Context7

Getting Started

  • Install the release that matches your framework: composer require lukeraymonddowning/laravel-template:^2.0. v2.0.0 targets Laravel 10, so confirm php -v (8.1+) and composer show laravel/framework before upgrading an existing app.
  • Read the package README and, just as importantly, its tests/ directory first — for a small utility package the test suite is the most accurate documentation of the supported API surface and naming conventions.
  • Check for a publishable config or stub set: php artisan vendor:publish --provider="LukeRaymondDowning\Template\TemplateServiceProvider" (verify the exact provider/config tag in the README). Publishing early avoids surprises where defaults change between minor releases.
  • First use case: take one repetitive Blade partial in your app — a card, an alert, a table row — and re-implement it as a single template class. Compare the call site in a real controller/view before rolling it out further; that diff is the fastest way to judge whether the abstraction pays for itself in your codebase.

Implementation Patterns

  • One class per template, rendered from views and controllers alike. Keep the template class as a thin presentation object: constructor/data() for inputs, a single render path for output. Controllers should not build markup; they pass a template instance (or the data to construct one) to the view.
  • Slots and composition over inheritance. For wrapper-style templates (panels, modals, layout shells), pass nested templates as slot content rather than adding boolean flags like $showFooter. Composition keeps each class small and testable.
  • Treat templates like Blade components in your conventions. If you already use anonymous/class-based Blade components, pick one approach per feature area — mixing both in the same view is where readability collapses.
  • Factory/helper methods for variants. Provide static constructors (Alert::danger($message)) that wrap the constructor so call sites stay declarative and variant names live in one place.
  • Testing. Assert on rendered output with Laravel's HTTP/views assertions (assertSee, assertSeeInOrder) rather than asserting on internal properties. For templates with conditional branches, write one test per branch — that's where regressions hide.
  • Wrapping third-party markup. Good fit for isolating vendor HTML (payment widgets, map embeds, cookie banners) so that vendor-specific markup and attributes live behind a stable PHP API in your app.
  • Incremental adoption. Introduce it in one module/domain namespace rather than app-wide; the payoff shows up where the same markup is repeated three or more times.

Gotchas and Tips

  • v2.0.0 is a major bump for a dependency change, not a feature change. The headline is Laravel 10 support; the major version implies Laravel 9 and below are no longer supported. Expect no new API to adopt, but budget for the upgrade.
  • Upgrade path: run composer why-not lukeraymonddowning/laravel-template ^2.0 to find the conflicting constraint (often laravel/framework, PHP, or a test tool), update composer.json, then composer update --with-all-dependencies. Run the full test suite plus php artisan view:clear afterwards — stale compiled views are a classic false-negative after dependency bumps.
  • Pin the constraint sensibly. Use ^2.0 rather than 2.0.*; do not use * on a package that is small enough to change shape between majors.
  • Config caching. php artisan config:cache will silently ignore runtime config() mutations; if template behaviour is configurable, set it in config/*.php or .env, then re-cache.
  • Autoload issues. After adding a new namespace of templates, run composer dump-autoload before debugging why a class "doesn't exist" — classmap/PSR-4 staleness is the most common false alarm.
  • Debugging output. Dump the raw rendered string (e.g. dd($template->render()) in a tinker session) rather than inspecting through the view layer; escaping, whitespace, and attribute-order issues are invisible in the browser.
  • Extension points to prefer: published config, published stubs, and subclassing the base template class. Avoid monkey-patching internals or overriding vendor views — those break silently on minor releases, and this package's release cadence (mostly dependency chores) means upstream is unlikely to flag breakage loudly.
  • Keep the wrapper thin. If you find yourself adding business logic, caching, or query building inside a template class, that logic belongs in a view model or presenter; the template should only format and render.
  • Stability signal. A repo whose recent releases are dependency chores with no README/docs churn is stable but lightly maintained — acceptable for a presentation-layer helper, not for anything load-bearing. Keep the abstraction narrow enough that you could swap it for plain Blade components in an afternoon.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo