承接 heapstersoft/stats-writer 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

heapstersoft/stats-writer

Composer 安装命令:

composer require heapstersoft/stats-writer

包简介

Php Stats Writer

README 文档

README

Intro

Stats is a small php project to help using stats from your current project. It supports any backend for which you want to write an adapter and it comes with one for statsd.

Installing

No actual installation is needed just add this to your composer.json require section:

	"heapstersoft/stats-writer": "1.0.x-dev"

Usage

First of all you need to include your composer autoload as with any project using composer:

	require 'vendor/autoload.php';

ideally you would do this in one central place and only once.

Then to send a stat to the backend (see configuration section) you need to create a stats object passing the config file as a first paramenter and the just use either increment or decrement:

	$statWriter = new \Heapstersoft\Stats\Writer('config/stats.yml');

	$statWriter->increment('key1');

For more information I encourage you to view the source code.

Congfiguration

Stats uses a simple YAML file as configuration with a mandatory "Adapter" key.

Under adapter you just neet the adapter class. The rest of the parameters ara adapter specific.

For an example configuration see the StatsD adapter section.

Adapters

StatsD

Example configuration file for StatsD:

	Adapter:
	  class: \Heapstersoft\Stats\Adapter\StatsD
	  host: "127.0.0.1"
	  port: 8125
	  key: "#host#.test.#key#"

All parameter should be self explainatory except for the "key" parameter.

Key allows you to customize the key string sent to the statsd backend. It suports any string with some special placeholders.

Right now these placeholders are: #host# that is replaced by the $_SERVER['HTTP_HOST'] variable and the #key# that is replaced for the value you pass to increment or decremant.

If no #key# is spcecified, it is appended.

统计信息

  • 总下载量: 14
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2012-11-25