Skip to content

phpbench/tabular-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tabular CLI

travis

This is a simple, demonstration, CLI for the PHPBench Tabular library.

Tabular is a library for generating tabular reports from XML files.

Example usage

Check the examples in the examples folder of this repository, usage as follows:

$ php bin/tabular report examples/books/books.xml examples/books/report.json

tabular-cli-phpbench

Definition file

The following is the Tabular definition for the report:

{
    "classes": {
        "euro": [
            [ "printf", {"format": "<info>€</info>%2d"} ]
        ]
    },
    "rows": [
        {
            "group": "body",
            "cells": [
                {
                    "name": "Title",
                    "expr": "string(./title)"
                },
                {
                    "name": "Stock",
                    "expr": "string(./stock)"
                },
                {
                    "name": "Price",
                    "class": "euro",
                    "expr": "number(./price)"
                },
                {
                    "name": "Author",
                    "expr": "string(./author)"
                },
                {
                    "name": "Stock Value",
                    "class": "euro",
                    "expr": "number(./price) * number(./stock)"
                }
            ],
            "with_query": ".//book"
        },
        {
            "cells": []
        },
        {
            "group": "footer",
            "cells": [
                {
                    "name": "Stock",
                    "literal": "Sum >>"
                },
                {
                    "name": "{{ cell.item }}",
                    "class": "euro",
                    "expr": "sum(//group[@name='body']//cell[@name='{{ cell.item }}'])",
                    "pass": 2,
                    "with_items": [ "Price", "Stock Value" ]
                }
            ]
        }
    ]
}

About

CLI for the tabular reporting library

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages