heapstersoft/stats-writer 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱: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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固