Graphite graph DSL to build URL query string for a graph (PSR-4 and PHP7 compatible)

2.1.0 2017-02-06 00:25 UTC

This package is auto-updated.

Last update: 2021-10-23 22:23:11 UTC


Latest Stable Version Build Status License

GraphBuilder is a DSL and ini-based templating language for PHP to assist in constructing URL query strings for use with Graphite graphs.

This is version 2 of the library (introducing eg. PSR-4 namespaces), based on original version by Bryan Davis.


Graphite provides several interfaces for creating graphs and dashboards, but one of its powerful features is an render API for generating graphs and retrieving raw data. This allows easy embedding of graphs in custom dashboards and other applications.

The process of describing complex graphs is however cumbersome at best. GraphBuilder attempts to reduce the complexity of embedding Graphite graphs in PHP based applications by providing a fluent API for describing graphs and a facility for loading full or partial graph descriptions from ini files.


Install using Composer:

$ composer require ondram/graphite-graph



$graphUrl = Graphite\GraphBuilder::builder()
        ->scale(1 / (1024 * 1024)) // B to MiB

echo '<img src="http://graphite.example.com/render?' . $graphUrl . '">';

For more usage examples see files in examples/ directory.


Originally written by Bryan Davis with support from Keynetics.

Updated to use PHP namespaces etc. by Ondrej Machulda.

Inspired by https://github.com/ripienaar/graphite-graph-dsl/.