protonemedia/laravel-blade-on-demand
protonemedia/laravel-blade-on-demand lets you compile and render Blade templates on the fly—including strings and dynamically generated views—without creating view files. Ideal for user-defined templates, CMS content, and email builders, with caching for performance.
Blade::render() (available since Laravel 9).Consider it when:
Blade::render()), or you need capabilities the native helper doesn't cover (component/layout resolution, caching of compiled strings, custom sanitization hooks).Look elsewhere when:
Blade::render() and avoid the dependency.To executives: This is a small, MIT-licensed library that lets us store page, email, and PDF templates as data instead of code. It unlocks customer-configurable templates and white-labeling without building a CMS — days of integration, not quarters. License cost is zero and the integration surface is one class. The trade-off is maintainer risk (single author, low adoption), so we'll wrap it behind our own interface and can switch to Laravel's built-in renderer later without product impact.
To engineering: It compiles Blade strings in memory using Laravel's own compiler, so existing components and directives work as-is. Adopt behind a TemplateRenderer contract, pin the version, add regression tests, and vendor/fork if it goes stale. One non-negotiable caveat: rendering untrusted templates is arbitrary PHP execution — expose authoring only to admins/trusted users, or pair it with a sandboxed engine.
How can I help you explore Laravel packages today?