承接 componenta/templater-app 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

componenta/templater-app

Composer 安装命令:

composer require componenta/templater-app

包简介

Componenta application integration for template rendering

README 文档

README

Application integration for componenta/templater. It registers the template engine, renderer, bootloader, static View helper, and global view() function.

Installation

composer require componenta/templater-app

The package exposes Componenta\Templater\App\ConfigProvider through Composer metadata and autoloads src/functions.php.

Registered Services

Componenta\Templater\App\ConfigProvider registers:

Service or key Registration
Componenta\Templater\Engine EngineFactory, using template config and PathResolverInterface.
Componenta\Templater\RendererInterface RendererFactory, wrapping the registered engine.
ViewBootloader Autowired bootloader.
AppConfigKey::BOOTLOADERS Adds ViewBootloader so View receives the renderer during application boot.

Configuration

Template settings are read from the renderer config section:

use Componenta\Templater\App\ConfigKey;

return [
    ConfigKey::ROOT => [
        ConfigKey::TEMPLATES_DIR => 'templates',
        ConfigKey::EXTENSION => 'phtml',
        ConfigKey::FOLDERS => [
            'mail' => 'templates/mail',
        ],
        ConfigKey::FUNCTIONS => [
            'asset' => static fn(string $path): string => '/assets/' . ltrim($path, '/'),
        ],
    ],
];

Paths are resolved through PathResolverInterface. The default template directory is templates, and the default extension is phtml.

Runtime Behavior

ViewBootloader runs in HTTP and CLI scopes. It gets RendererInterface from the container and installs it into View::setRenderer(). After boot, code can call:

echo view('welcome', ['name' => 'Componenta']);
echo Componenta\Templater\App\View::render('welcome');

Calling view() or View::render() before the bootloader runs throws LogicException.

Boundary

The package wires templates into an application. The renderer implementation itself lives in componenta/templater; path resolution lives in componenta/path-resolver.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固