icanboogie/render
Composer 安装命令:
composer require icanboogie/render
包简介
Renders templates with a variety of template engines.
README 文档
README
An API to render templates with a variety of template engines.
Installation
composer require icanboogie/render
Render engines
Templates may be rendered with a variety of template engines.
The following example demonstrates how to create an engine provider with the builtin engine for PHP templates.
<?php /* @var ICanBoogie\Render\PHPEngine $engine */ /* @var string $template_pathname */ /* @var mixed $content */ /* @var array<string, mixed> $variables */ $rendered = $engine->render($template_pathname, $content, $variables);
Note: Currently, the package only provides an engine to render PHP templates, the available engine can be extended with third parties packages such as render-engine-markdown or render-engine-patron.
Render engine providers
Render engines are obtained through engine providers. The following providers are builtin:
- EngineProvider\Container: Provides engines from a PSR container.
- EngineProvider\Immutable: Provides engines from an immutable collection.
- EngineProvider\Mutable: Provides engines from a mutable collection.
The following examples demonstrates how to obtain an engine for a .php extension from an immutable
provider.
<?php use ICanBoogie\Render\EngineProvider\Immutable; use ICanBoogie\Render\PHPEngine; $engines = new Immutable([ '.php' => new PHPEngine() ]); echo $engines->engine_for_extension('.php')::class; // ICanBoogie\Render\PHPEngine
All engine providers are traversable, this feature can be used to collect the supported extensions:
<?php /* @var EngineProvider $engines */ $extensions = array_keys(iterator_to_array($engines)); echo implode(', ', $extensions); // .php
The pathname of the template being rendered
Engines should use the Engine::VAR_TEMPLATE_PATHNAME variable to define the pathname of the
template being rendered, so that it is easy to track which template is being rendered and from
which location.
Template resolver
A template resolver tries to match a template name with an actual template file. A set of paths can be defined for the resolver to search in.
Renderer
A Renderer instance is used to render a template with a subject and options. An engine collection and a template resolver are used to find suitable templates for the rendering.
Continuous Integration
The project is continuously tested by GitHub actions.
Code of Conduct
This project adheres to a Contributor Code of Conduct. By participating in this project and its community, you're expected to uphold this code.
Contributing
See CONTRIBUTING for details.
icanboogie/render 适用场景与选型建议
icanboogie/render 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.18k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2014 年 11 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「render」 「decorate」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 icanboogie/render 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 icanboogie/render 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 icanboogie/render 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A simple Trait that implements the Decorator pattern on Laravel eloquent models.
Render small SVG icons to monochrome ANSI for terminal UIs (Laravel/Prompts, Symfony Console, plain CLI).
Common Render Api Interface
Create mail from controller action render
Pagination Support for PHP Applications
E2E Studios PHP Framework adaptation of leafsphp/blade package
统计信息
- 总下载量: 2.18k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 9
- 依赖项目数: 4
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2014-11-07