earthit/paxml
最新稳定版本:2.0.0
Composer 安装命令:
composer require earthit/paxml
包简介
Classes for emitting X[HT]ML.
README 文档
README
PAXML: PHP Array [representation of] XML
This is a tiny library for emitting XML. Or XHTML.
Its intended use is to replace HTML/PHP template code with something easier to read and write and manipulate.
e.g. instead of
<p>Hi my name is <?php echo htmlspecialchars($name); ?></p>
you would construct a PAXML value like:
$value = ['p', 'Hi my name is ', $name];
and then output it using
EarthIT_PAXML::emit($value);
If you need a Nife_Blob, make one like so:
$blob = new EarthIT_PAXML_PAXMLBlob($value);
PAXML Values
Scalars represent text.
Arrays represent elements.
The 0th element of an array gives the tag name.
Subsequent numerically-keyed elements of an array give sub-tags.
String-keyed elements of an array give attribute values.
Examples
['p', 'style'=>'color: green', 'I like ', ['span', 'style'=>'color: red', 'food'], '.']
Will be emitted as:
<p style="color: green">I like <span style="color: red">food</span>.</p>
统计信息
- 总下载量: 12.73k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-08-27