ricbra / php-kissmetrics-api
基于Guzzle实现的KISSmetrics REST API
dev-master / 1.0.x-dev
2014-12-24 10:53 UTC
Requires
- php: >=5.4.0
- guzzlehttp/guzzle: ~5.0
- guzzlehttp/guzzle-services: ~0.4.0
Requires (Dev)
- phpunit/phpunit: ~4
This package is not auto-updated.
Last update: 2024-09-24 03:19:50 UTC
README
这个库是KISSmetrics API的PHP 5.4实现,详细信息请见KISSmetrics API规范
此客户端使用Guzzle 4.0构建。
许可证
此库在MIT许可证下发布。完整的许可证请见LICENSE文件。
安装
首先通过安装Composer。接下来执行
$ composer require ricbra/php-kissmetrics-api
需求
PHP >=5.4.0
使用方法
创建一个新的实例
<?php $client = \KISSmetrics\ClientFactory::factory('your-api-key-here', [ 'defaults' => [ 'headers' => ['User-Agent' => 'your-app-name/1.0.0 +https://yourapp.com'] ] ]);
设置用户属性
<?php $client->setProperties([ '_p' => 'Facebook #23', '_d' => 1, '_t' => 21421421, 'Property' => 'Value' ]);
记录事件
<?php $client->recordEvent([ '_p' => 'Facebook #23', '_n' => 'Test event', '_t' => 12421412, '_d' => 1, 'Property' => 'Value', ]);
别名用户
<?php $client->recordEvent([ '_p' => 'Facebook #23', '_n' => 'Test event', '_t' => 12421412, '_d' => 1, 'Property' => 'Value', ]);