定制 salesmachine-io/salesmachine-php 二次开发

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

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

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 我们能提供哪些服务?
定制开发 / 二次开发

基于 salesmachine-io/salesmachine-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 5
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-09-03