PHPackages                             jonnx/datadog-client - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. jonnx/datadog-client

ActiveLibrary[HTTP &amp; Networking](/categories/http)

jonnx/datadog-client
====================

Standalone DataDog PHP Client, works without datadog agent

2.0.1(3y ago)024.1kMITPHPPHP &gt;=5.3

Since Nov 11Pushed 3y ago1 watchersCompare

[ Source](https://github.com/Jonnx/datadog-client)[ Packagist](https://packagist.org/packages/jonnx/datadog-client)[ Docs](https://github.com/jonnx/datadog-client)[ RSS](/packages/jonnx-datadog-client/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (4)Used By (0)

Datadog PHP Client
==================

[](#datadog-php-client)

> Lightweight php-only datadog client

This is a simple php client for datadog which does not require setting up the [DataDog Agent](https://app.datadoghq.com/account/settings#agent)This library supports sending metric data or events at the moment, as those should be the most common use cases. Feel free to extend it to your own needs or sending pull requests.

Installation
------------

[](#installation)

This library can be installed using composer

```
composer require jonnx/datadog-client

```

Getting Started
---------------

[](#getting-started)

To start sending requests to Datadog you need to provider your personal API key first. You find that key in [Datadog API Settings](https://app.datadoghq.com/account/settings#api).

```
$client = new Client('mysecretapikey');

```

Sending Events
--------------

[](#sending-events)

Events can be sent directly to Datadog using the provided Event class:

```
$myEvent = new Event('This is my test event', 'Optional event title');
$client->sendEvent($myEvent);

```

Additional properties can be set the usual way:

```
$myEvent->setAlertType(Event::TYPE_ERROR);

```

#### There is also a shortcut method which handles all that stuff for you:

[](#there-is-also-a-shortcut-method-which-handles-all-that-stuff-for-you)

```
// Create and send event in one call
$client->event('My test event', 'Optional event title', array(
    'alert_type' => Event::TYPE_ERROR
));

```

### Event Properties

[](#event-properties)

#### dateHappened

[](#datehappened)

Type: `integer`

Timestamp of the event. Defaults to current timestamp.

#### priority

[](#priority)

Type: `Event::PRIORITY_`

Event priority. Datadog supports LOW and NORMAL

#### alertType

[](#alerttype)

Type: `Event::TYPE_`

Event alert\_type. Datadog supports INFO, WARNING, ERROR and SUCCESS

#### aggregationKey

[](#aggregationkey)

Type: `string`

Arbitary string used to group events

Sending Metrics
---------------

[](#sending-metrics)

Datadog requires metric data to be encapsulated into a series. One series contains one or more metric objects, which itself contains one or more measurement points.

```
// Create Series
$mySeries = new Series();

// Create a new metric with multiple points
$firstMetric = new Metric('my.metric.name', array(
    array(20),            // Dummy points
    array(13456789, 30),  // Point with timestamp set
    array(40),            // If not set, timestamp default to current time
));

// Create a new metric with one point
$secondMetric = new Metric('my.second.metric', array(20));

$mySeries->addMetrics(array(
    $firstMetric,
    $secondMetric
));

// Send data
$client->sendSeries($mySeries);

```

If you want to send just one metric at a time, you can use the Client::sendMetric method:

```
// Create a new metric with multiple points
$myMetric = new Metric('my.metric.name', array(
    array(20),            // Dummy points
    array(13456789, 30),  // Point with timestamp set
    array(40),            // If not set, timestamp default to current time
));

$client->sendMetric($myMetric);

```

#### Again, there is a shortcut method which can handle that for you:

[](#again-there-is-a-shortcut-method-which-can-handle-that-for-you)

```
$client->metric('my.test.metric', array(
    array(20),
    array(13456789, 30),
    array(40),
));

```

### Metric Properties

[](#metric-properties)

#### name

[](#name)

Type: `string`

Name of the metric. Can contain underscored or dots for easier grouping, e.g. web.exception.404

#### type

[](#type)

Type: `Metric::TYPE_`

Type of the metric. Datadog supports gauge or counter

#### host

[](#host)

Type: `string`

Hostname of the source machine

#### points

[](#points)

Type: `array`

Array of data points.

A point consists of an optional timestamp and a numeric value. If no timestamp is specified, the current timestamp will be used. Order matters. If a timestamp is specified, it should be the first value.

Examples:

```
  // Timestamp will be set to time()
  $simplePoint = array(20);

  // Set timestamp to explicit value
  $pointWithTimestamp = array(1234567, 20);

```

Origin of this package
----------------------

[](#origin-of-this-package)

This is a re-upload of the original repository removed by the orignal author [Matthias Bayer](https://github.com/matthiasbayer). Class names and paths have been updated to submit this project to packagist. This ensures it can easily be installed using composer out of the box.

Source:

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~2 days

Total

3

Last Release

1279d ago

Major Versions

1.1.2 → 2.0.02022-11-14

### Community

Maintainers

![](https://www.gravatar.com/avatar/223ceec567c8ac8fba483b2c9d52f538ea0d9a1cb02a90dc5d75e933df164663?d=identicon)[Jonnx](/maintainers/Jonnx)

---

Top Contributors

[![Jonnx](https://avatars.githubusercontent.com/u/1399475?v=4)](https://github.com/Jonnx "Jonnx (5 commits)")

---

Tags

httpclientDataDogstandalone

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jonnx-datadog-client/health.svg)

```
[![Health](https://phpackages.com/badges/jonnx-datadog-client/health.svg)](https://phpackages.com/packages/jonnx-datadog-client)
```

###  Alternatives

[m6web/guzzle-http-bundle

Symfony bundle on top of Guzzle

17511.5k2](/packages/m6web-guzzle-http-bundle)[swoole/etcd-client

Grpc PHP Client base on Swoole Http2 Coroutine

1973.2k1](/packages/swoole-etcd-client)[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28137.8k](/packages/phpro-http-tools)[chillerlan/php-httpinterface

A PSR-7/17/18 http message/client implementation

1417.1k5](/packages/chillerlan-php-httpinterface)

PHPackages © 2026

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