定制 michaelesmith/event-data 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

michaelesmith/event-data

Composer 安装命令:

composer require michaelesmith/event-data

包简介

Abstracts event data handling

README 文档

README

Build Status

README

What is it?

This is a library that allows for easy abstraction of event data collection and storage, allowing it to be stored locally or external service..

Installation

Use Composer (recommended)

Get Composer at http://getcomposer.org

php composer.phar require "michaelesmith/event-data" "dev-master"

Examples

This isn't very useful in production to store the events in a local file but might be useful during configuration. You can also configure loggers.

$edm = new \MS\EventData\EventDataManager(new \MS\EventData\Storage\File('/tmp/events.txt'));
$edm->addLogger(new \MS\EventData\Logger\GenericLogger());
$edm->store(new \MS\EventData\Event\Event('collection', ['field1' => 'val1']));

By default it will send the event immediately but this can be configured.

$edm->setDelayed(true);

$edm->store(new \MS\EventData\Event\Event('collection', ['field1' => 'val1']));
...
$edm->store(new \MS\EventData\Event\Event('collection', ['field1' => 'val1']));
...

$edm->flush();

In this example the events are not sent to the storage until flush is called.

You can also put it in debug mode so events are logged but never sent to storage.

$edm->setDebug(true);

$edm->store(new \MS\EventData\Event\Event('collection', ['field1' => 'val1']));

Finally a useful example. Here we send the event data to KeenIO and log with PSR logger like Monolog.

$edm = new \MS\EventData\EventDataManager(new \MS\EventData\Storage\KeenIO($keenClient));
$edm->addLogger(new \MS\EventData\Logger\PSRLogger($monolog, $edm));
$edm->setDebug(DEBUG_MODE);
$edm->setDelayed(true);

...
$edm->store(new \MS\EventData\Event\Event('collection', ['field1' => 'val1']));
...

$edm->flush(); //after the response has been returned to the user

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-06-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固