salesmachine-io/salesmachine-php
Composer 安装命令:
composer require salesmachine-io/salesmachine-php
包简介
The Salesmachine.io PHP library
README 文档
README
salesmachine-php is a library which allows you to easily send data from your PHP aplication to SalesMachine.IO. The library can be used right away without a complicated setup as shown in the examples below.
When using this library in a high traffic production environment you can use different options to optimize the behavior. See the chapter Usage in Production Environments and Options for more details.
Requirements
First off, you need to have an account at SalesMachine.IO and be in possession of valid API credentials. The requirements regarding your PHP environment are quite basic:
- PHP 5.x
- CURL module
- JSON module
Quick Guide and Code Examples
Installation
The salesmachine-php client library comes as a Composer package.
Init Salesmachine
Salesmachine::init($api_key, $api_secret, array('use_buffer' => true));
Create or Update a Contact
Salesmachine::set_contact($contact_uid, array('name' => 'John Doe', 'email' => 'john@doe.com'));
Track Pageview of a Contact
Salesmachine::track_pageview($contact_uid, array('/dashboard'));
Track Events of a Contact
Salesmachine::track_event($contact_uid, 'your event name');
Using salesmachine-php in Production Environments
While the default settings get you going right away, it is recommended to change some settings for production environments.
By default, all requests to SalesMachine.IO are with CURL in real time. On a high traffic environment this can eventually lead to reduced performance on the host site. It is therefore recommended to enable the option "use_buffer" which will buffer all requests to a local file first.
The local buffer can then be sent with a cron job in regular intervals by using the code below. This method ensures that the SalesMachine.IO library won't degrade the performance of the host environment.
Store a requests in local buffer
Salesmachine::init($api_key, $api_secret, array('use_buffer' => true));
Salesmachine::set_contact($contact_uid, array('name' => 'John Doe', 'email' => 'john@doe.com'));
...
Process local buffer in cron job
Salesmachine::init($api_key, $api_secret);
Salesmachine::flush();
Options
When calling Salesmachine::init($api_key, $api_secret) an array of options can be passed as a third parameter. If this parameter is not present or option keys are missing, the default values are taken.
| Option | Default | Description |
|---|---|---|
| use_https | true | Whether or not to send the data to SalesMachine SSL encrypted |
| use_buffer | true | If set to false, requests will be sent one by one instead of batch. This is not recommended since it will add load to Salesmachine.io servers. |
| debug | false | If activated, debug information will be written to the log file in test/analytics-xx.log |
Additional Information
For more information please visit
salesmachine-io/salesmachine-php 适用场景与选型建议
salesmachine-io/salesmachine-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 181.37k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 09 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「analytics」 「salesmachine」 「salesmachine-php」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 salesmachine-io/salesmachine-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 salesmachine-io/salesmachine-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 salesmachine-io/salesmachine-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Analytics chooser extensions for site settings.
A Laravel Nova Card to show Fathom Analytics stats.
Laravel 5 package to retrieve Google Analytics data.
Scout Extended extends Laravel Scout adding algolia-specific features
PHP library for Bluelabs Erwin
A PHP & WordPress library for sending analytics data to WP Power Analytics
统计信息
- 总下载量: 181.37k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 17
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-09-03