jaypha/jayponents
Composer 安装命令:
composer require jaypha/jayponents
包简介
Construct documents with heirarchical components
README 文档
README
Written by Jason den Dulk
Construct documents with heirarchical components.
Features
-
Usable with any template engine via adaptors. Uses PHP by default.
-
Hierarchical. Components can be added to other Components to create docuemnts of arbitrary complexity. No need for partials, layouts or helpers as
Componentcan be used for all of these roles. -
You can create custom component classes that allow you to have extra, specific business logic that can be kept out of the template, or handle boilerplate you dont want to have repeated in every template file.
Requirements
PHP v7.1.0 or greater.
Installation
composer require jaypha/jayponents
API
class Component
static void setDefaultEngine(TemplateEngineAdaptor $a)
Sets the default template engine. If none is provided, then PHP will be used.
void setEngine(TemplateEngineAdaptor $a)
Sets the template engine to be used for this component. If none is set, then
the default engine set via setDefaultEngine will be used.
void setTemplate(string $template = null)
Sets the template file or string (if possible)
void setVars(array $values)
Sets all the values.
void set(string $name, mixed $value)
Sets a single value
void remove(string $name)
Removes a value stored under $name.
void add(mixed $value)
Adds a value without a name. Useful when no template is being used.
void clear()
Removes all values.
void display()
Prints the contents directly to the output.
string __toString()
Returns the contents as a string.
class PhpFileAdaptor
Adaptor to use PHP itself as the template engine.
class PhpTextAdaptor
Adaptor to allow the PHP template to be passed directly as a string.
class TextComponent
Behaves the same as Component except that the template is provided directly
instead of via a file.
License
Copyright (C) 2017-8 Jaypha.
Distributed under the Boost Software License, Version 1.0.
jaypha/jayponents 适用场景与选型建议
jaypha/jayponents 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 98 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 01 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 jaypha/jayponents 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jaypha/jayponents 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 98
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: BSL-1.0
- 更新时间: 2019-01-30