PHPackages                             grafana/foundation-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. grafana/foundation-sdk

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

grafana/foundation-sdk
======================

A set of tools, types and libraries for building and manipulating Grafana objects.

v0.0.18(3w ago)24446.9k↓55.7%17[13 issues](https://github.com/grafana/grafana-foundation-sdk/issues)[13 PRs](https://github.com/grafana/grafana-foundation-sdk/pulls)Apache-2.0PHPCI passing

Since Jul 21Pushed 3d ago105 watchersCompare

[ Source](https://github.com/grafana/grafana-foundation-sdk)[ Packagist](https://packagist.org/packages/grafana/foundation-sdk)[ Docs](https://github.com/grafana/grafana-foundation-sdk)[ RSS](/packages/grafana-foundation-sdk/feed)WikiDiscussions main Synced 3d ago

READMEChangelogDependenciesVersions (152)Used By (0)

Grafana Foundation SDK
======================

[](#grafana-foundation-sdk)

The Grafana Foundation SDK is a set of ***types***, and ***builder libraries***that let you define Grafana dashboards and other resources using strongly typed code. By writing your resources as code, you can:

- **Leverage strong typing**: Catch errors at compile time, ensuring more reliable configurations.
- **Enhance version control**: Track changes seamlessly using standard version control systems like Git.
- **Automate deployments**: Integrate dashboard provisioning into your CI/CD pipelines for consistent and repeatable setups.

The SDK supports multiple programming languages, including **Go**, **TypeScript**, **Python**, **PHP**, and **Java**, so you can choose the one that best fits your development environment.

Note

This SDK is best suited for Grafana &gt;= 12, but will work with Grafana &gt;= 10.

Overview
--------

[](#overview)

Here's a quick overview of how the SDK works:

- **Builder pattern**: The SDK implements the builder pattern to let you define dashboards fluently. You start with a `DashboardBuilder`, then add panels, queries, and other components step by step.
- **Strong typing**: Everything in the SDK is strongly typed. This gives you autocompletion in your IDE, catches mistakes early, and helps ensure you're always using valid configuration values.
- **Structured options**: When a configuration gets complex (like data reduction or display settings), the SDK uses typed option builders to keep things readable and predictable.
- **Resources**: Multiple resources are supported by the SDK. Dashboards, alerts, …

For example, here is how a dashboard can be built in Go:

```
package main

import (
    "encoding/json"
    "fmt"

    "github.com/grafana/grafana-foundation-sdk/go/common"
    "github.com/grafana/grafana-foundation-sdk/go/dashboard"
    "github.com/grafana/grafana-foundation-sdk/go/prometheus"
    "github.com/grafana/grafana-foundation-sdk/go/timeseries"
    "github.com/grafana/grafana-foundation-sdk/go/units"
)

func main() {
    builder := dashboard.NewDashboardBuilder("Sample dashboard").
        Uid("generated-from-go").
        Tags([]string{"generated", "from", "go"}).
        Refresh("1m").
        Time("now-30m", "now").
        Timezone(common.TimeZoneBrowser).
        WithRow(dashboard.NewRowBuilder("Overview")).
        WithPanel(
            timeseries.NewPanelBuilder().
                Title("Network Received").
                Unit(units.BitsPerSecondSI).
                Min(0).
                WithTarget(
                    prometheus.NewDataqueryBuilder().
                        Expr(`rate(node_network_receive_bytes_total{job="integrations/raspberrypi-node", device!="lo"}[$__rate_interval]) * 8`).
                        LegendFormat("{{ device }}"),
                ),
        )

    sampleDashboard, err := builder.Build()
    if err != nil {
        panic(err)
    }
    dashboardJson, err := json.MarshalIndent(sampleDashboard, "", "  ")
    if err != nil {
        panic(err)
    }

    fmt.Println(string(dashboardJson))
}
```

Note

More examples can be found in the [`./examples/`](https://github.com/grafana/grafana-foundation-sdk/tree/main/examples) folder.

Publishing resources
--------------------

[](#publishing-resources)

After you've defined your resource as code, call the `build()` function (its actual name might be slightly different depending on language choice) and output the result as a JSON.

With the JSON payload, you can:

- Call [Grafana's API](https://grafana.com/docs/grafana/latest/developer-resources/api-reference/http-api/) to programmatically manage the resource.
- Use [Grafana CLI](https://grafana.com/docs/grafana/latest/as-code/observability-as-code/grafana-cli/) to publish the resource from CLI.

Next steps
----------

[](#next-steps)

With the basics of using the Grafana Foundation SDK in mind, here are some possible next steps:

- **Explore more features**: Check out the full [API reference](https://grafana.github.io/grafana-foundation-sdk/) to learn more about what the SDK can do.
- **Version control your resources**: Store your resources code in Git to track changes over time.
- **Automate provisioning with CI/CD**: [Integrate the SDK into your CI/CD pipeline](https://grafana.com/docs/grafana/latest/as-code/observability-as-code/foundation-sdk/dashboard-automation/) to deploy dashboards and other resources automatically.
- **Explore a more [real-world example of using the SDK](https://www.youtube.com/watch?v=ZjWdGVsrCiQ)**

Contributing
------------

[](#contributing)

Contributions are welcome! See [CONTRIBUTING.md](./CONTRIBUTING.md) for more information.

Maturity
--------

[](#maturity)

The code in this repository should be considered as "public preview". While it is used by Grafana Labs in production, it still is under active development.

Note

Bugs and issues are handled solely by Engineering teams. On-call support or SLAs are not available.

License
-------

[](#license)

[Apache 2.0 License](./LICENSE)

###  Health Score

57

—

FairBetter than 97% of packages

Maintenance96

Actively maintained with recent releases

Popularity49

Moderate usage in the ecosystem

Community30

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 54.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~7 days

Recently: every ~2 days

Total

18

Last Release

22d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/28509e7b5a448032cc485c257769defdccf87ff5c360b0e6ec9ca6978d513b14?d=identicon)[grafana-cat](/maintainers/grafana-cat)

---

Top Contributors

[![K-Phoen](https://avatars.githubusercontent.com/u/66958?v=4)](https://github.com/K-Phoen "K-Phoen (315 commits)")[![renovate-sh-app[bot]](https://avatars.githubusercontent.com/u/7195757?v=4)](https://github.com/renovate-sh-app[bot] "renovate-sh-app[bot] (122 commits)")[![spinillos](https://avatars.githubusercontent.com/u/4040733?v=4)](https://github.com/spinillos "spinillos (77 commits)")[![nikimanoledaki](https://avatars.githubusercontent.com/u/18622989?v=4)](https://github.com/nikimanoledaki "nikimanoledaki (21 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (18 commits)")[![julienduchesne](https://avatars.githubusercontent.com/u/29210090?v=4)](https://github.com/julienduchesne "julienduchesne (4 commits)")[![phlope](https://avatars.githubusercontent.com/u/44029471?v=4)](https://github.com/phlope "phlope (4 commits)")[![malcolmholmes](https://avatars.githubusercontent.com/u/42545407?v=4)](https://github.com/malcolmholmes "malcolmholmes (3 commits)")[![ArturWierzbicki](https://avatars.githubusercontent.com/u/23451458?v=4)](https://github.com/ArturWierzbicki "ArturWierzbicki (2 commits)")[![jan-xyz](https://avatars.githubusercontent.com/u/5249233?v=4)](https://github.com/jan-xyz "jan-xyz (2 commits)")[![jjmaestro](https://avatars.githubusercontent.com/u/425680?v=4)](https://github.com/jjmaestro "jjmaestro (1 commits)")[![Matts966](https://avatars.githubusercontent.com/u/28551465?v=4)](https://github.com/Matts966 "Matts966 (1 commits)")[![mblls](https://avatars.githubusercontent.com/u/38448078?v=4)](https://github.com/mblls "mblls (1 commits)")[![jakubno](https://avatars.githubusercontent.com/u/50249709?v=4)](https://github.com/jakubno "jakubno (1 commits)")[![harisrozajac](https://avatars.githubusercontent.com/u/58232930?v=4)](https://github.com/harisrozajac "harisrozajac (1 commits)")[![ppcano](https://avatars.githubusercontent.com/u/825430?v=4)](https://github.com/ppcano "ppcano (1 commits)")[![fxrlv](https://avatars.githubusercontent.com/u/9749087?v=4)](https://github.com/fxrlv "fxrlv (1 commits)")[![Duologic](https://avatars.githubusercontent.com/u/3349855?v=4)](https://github.com/Duologic "Duologic (1 commits)")[![stevesg](https://avatars.githubusercontent.com/u/78375245?v=4)](https://github.com/stevesg "stevesg (1 commits)")[![tamird](https://avatars.githubusercontent.com/u/1535036?v=4)](https://github.com/tamird "tamird (1 commits)")

---

Tags

sdklogsMetricsobservabilitygrafanatraces

### Embed Badge

![Health badge](/badges/grafana-foundation-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/grafana-foundation-sdk/health.svg)](https://phpackages.com/packages/grafana-foundation-sdk)
```

###  Alternatives

[aws/aws-crt-php

AWS Common Runtime for PHP

423329.7M10](/packages/aws-aws-crt-php)[ennnnny/tbk

简约优雅的淘宝客SDK

29016.5k1](/packages/ennnnny-tbk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
