phpbench/tabular
最新稳定版本:0.4.1
Composer 安装命令:
composer require phpbench/tabular
包简介
Generate complex tables from simple configuration
README 文档
README
Tabular is a library for transforming a source XML document into a tabular XML document using a given configuration. The resulting tabular XML document can then transformed or used to easily render tables (for example in HTML or in the console).
Tabular is better than spreadsheets.
Documentation
See the official documentation.
Example
The central concept is the definition file:
{ "rows": [ { "cells": [ { "name": "title", "expr": "string(./title)" }, { "name": "price", "expr": "number(./price)" } ], "with_query": "//book" }, { "cells": [ { "name": "price", "expr": "sum(//price)" } ] } ] }
The above definition will generate a table representation in XML with a row
for each <book/> element in the given XML file and provide an additional row
showing the sum of all the <price/> elements of the <book/> element.
So given the following XML file:
<?xml version="1.0"?> <store> <book> <title>War and Peace</title> <price>5.00</price> </book> <book> <title>One Hundered Years of Soliture</title> <price>7</price> </book> </store>
The generated table might look like this (as rendered by the Tabular CLI):
┌────────────────────────────────┬───────┐
│ title │ price │
├────────────────────────────────┼───────┤
│ War and Peace │ 5 │
│ One Hundered Years of Soliture │ 7 │
│ │ 12 │
└────────────────────────────────┴───────┘
统计信息
- 总下载量: 14.86k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-08-20
