Download the PHP package cosmastech/statsd-client-adapter without Composer

On this page you can find all versions of the php package cosmastech/statsd-client-adapter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package statsd-client-adapter

Latest Stable Version Total Downloads License PHP Version Require

StatsD Client Adapter

This package was originally designed to solve the problem of:

Where might I want to push those precious stats? Maybe to a log? Maybe to a locally running StatsD server? What if in my unit tests, I want to confirm that logs are being pushed, but not go through the hassle of an integration test set up that configures the StatsD server?

While PHP League's statsd package is great, it doesn't allow for sending DataDog specific stats (such as histogram or distribution). Nor does the DataDog client allow for pushing to another StatsD implementation easily.

The aim here is to allow for a single interface that can wrap around both, and be easily extended for different implementations.

If you would like to use this library in Laravel, check out laravel-statsd-adapter.

Adapters

InMemoryClientAdapter

This adapter simply records your stats in an object in memory. This is best served as a way to verify stats are recorded in your unit tests.

See examples/in_memory.php for how you might implement this.

DataDogStatsDClientAdapter

This is a wrapper around DataDog's php-datadogstatsd client.

If you wish to use this adapter, please make sure you install the php-datadogstatsd client.

For specifics on their configuration, see the official DogStatsD documentation.

See examples/datadog.php for how you might implement this.

DatadogLoggingClient

Envisioned as a client for local development, this adapter writes to a class which implements the psr-logger interface. You can find a list of packages that implement the interface on packagist. If you are using a framework like Symfony or Laravel, then you already have one of the most popular and reliable implementations installed: monolog/monolog.

For a local development setup, you could just write the stats to a log. This writes the format exactly as it would be sent to DataDog.

See examples/log_datadog.php for how you might implement this.

LeagueStatsDClientAdapter

You can also write to an arbitrary statsd server by leveraging PHP League's statsd package.

First ensure that the package has been installed.

For information on how to configure Client, read their documentation.

Note the histogram() and distribution() methods are both no-op by default, as they are not available on statsd.

See examples/league.php for how you might implement this.

Gotchas

  1. Only increment/decrement on DataDog's implementation allow for including the sample rate. If you are using a sample rate with other calls, their sample rate will not be included as part of the stat.
  2. There are histogram() and distribution() methods on LeagueStatsDClientAdapter, but they will not be sent to statsd.

Testing


All versions of statsd-client-adapter with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
psr/clock Version ^1.0.0
psr/log Version ^3.0.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package cosmastech/statsd-client-adapter contains the following files

Loading the files please wait ....