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

Template Bundle Laravel Package

jaem3l/template-bundle

jaem3l/template-bundle is a Laravel/PHP package that provides a convenient template bundle for organizing and rendering reusable templates. It simplifies template management and integrates smoothly with Blade, helping you keep view logic clean, consistent, and easy to maintain.

View on GitHub
Deep Wiki
Context7

Getting Started

Start by installing the package and checking what v1.1.0 actually ships:

composer require <vendor>/<package>

Then look at, in order:

  1. The package README and CHANGELOG.md for the new TemplateController.
  2. The controller source itself — confirm its namespace, constructor dependencies, and whether it is invokable (__invoke) or exposes named actions.
  3. Any package config file (config/<package>.php) and whether it needs publishing with php artisan vendor:publish.
  4. The package service provider to see what routes, views, or bindings are registered automatically.

The first practical use case is replacing a closure-based template route with the new controller:

// routes/web.php
use Vendor\Package\Http\Controllers\TemplateController;

Route::get('/pages/{page}', TemplateController::class)->name('pages.show');

Create or point the controller at a view (for example resources/views/pages/{page}.blade.php), then visit /pages/about. If the controller expects a specific route parameter name or a configured view namespace, match that before adding your own logic.

Because this is a new controller in a minor release, verify the exact route parameter and view-resolution contract from the package source rather than assuming it mirrors other templating packages.

Implementation Patterns

Use the controller as a thin routing layer. Let TemplateController resolve and render templates, and keep authorization, redirects, and data loading in middleware, route defaults, or a dedicated controller that delegates to it.

Route-per-template pattern. For small marketing or CMS-style sites, register explicit routes rather than a catch-all:

Route::get('/about', TemplateController::class)->defaults('template', 'pages.about');
Route::get('/pricing', TemplateController::class)->defaults('template', 'pages.pricing');

Confirm whether the controller reads route defaults, a route parameter, or a config mapping.

Parameterised pages. If the controller accepts a {page} parameter, constrain it to avoid collisions with other routes:

Route::get('/pages/{page}', TemplateController::class)
    ->where('page', '[A-Za-z0-9\-]+')
    ->name('pages.show');

Middleware integration. Apply auth, locale, or cache headers at the route level so the controller stays reusable:

Route::middleware(['web', 'auth'])->group(function () {
    Route::get('/docs/{page}', TemplateController::class);
});

Testing. Use Laravel feature tests to assert the rendered view and status code. If the controller resolves templates dynamically, include a test for a missing template so you know whether it returns 404 or throws.

Incremental adoption. Keep existing Route::view() and closure routes in place, and migrate one route at a time to TemplateController. This is especially useful if the controller adds behaviour such as fallback templates, metadata, or theme resolution.

Gotchas and Tips

  • The release note is minimal. The note only says a TemplateController was added. Check the controller signature and README before relying on route defaults, parameter names, or view namespaces.
  • Route parameter naming. Dynamic template controllers commonly depend on a specific parameter name (often {template}, {page}, or {slug}). A mismatch usually surfaces as a missing argument or a 404, not an obvious exception.
  • View resolution and escaping. If the controller builds a view name from user input, constrain the route parameter and reject path traversal attempts. Never pass an unvalidated route segment directly into view().
  • Caching. Template or view caching may need clearing after config changes: php artisan view:clear and php artisan config:clear. If the controller caches resolved templates, check whether the package exposes a cache key or TTL.
  • Authorization. A generic template controller can make every matching page publicly reachable. Add explicit middleware or an allow-list of templates rather than assuming the controller handles access control.
  • Version pinning. Since this is a new feature in v1.1.0, pin the minor version in composer.json until the controller’s API stabilises: "<vendor>/<package>": "^1.1".
  • Extension points. Look for a published config file, a view namespace, or a resolvable template repository. If the controller is final or internally coupled, prefer wrapping it in your own controller rather than modifying vendor code.
  • Debugging 404s. If a route resolves but the page is not found, check the view path first, then the route parameter constraint, then whether the package expects templates in a non-default directory.
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.
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
frankyso/ipaymu
3mdikram/worldmoneywords
snowsoft/config
itmosoft/laravel-subscriptions
larva/laravel-ai-qwen
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core