定制 markey-magic/tractionphp 二次开发

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

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

markey-magic/tractionphp

Composer 安装命令:

composer require markey-magic/tractionphp

包简介

Traction API Library

README 文档

README

Traction is a relationship marketing platform that makes it easy to manage multi-channel campaigns and build brand advocacy through the effective use of data.

This is a PHP implementation of their API.

  • PHP 5.3+ Library
  • Curl Transport (via Buzz)

Example

Classic API

<?php

use Traction\Request\Type\Customer;
use Traction\Request\Promotion;
use Traction\Handler;

// use the customer class to structure your customer information
$customer = new Customer;
$customer->setEmailOpt(Customer::OPT_IN);
$customer->setFirstName('John');
$customer->setLastName('Smith');
$customer->setEmail('john@example.com');

// create a promotion request
$promo = new Promotion;
$promo->setPromotionId(12345);
$promo->setMatchKey(Promotion::MATCHKEY_EMAIL);
$promo->setMatchValue('john@example.com');
$promo->setCustomer($customer);
$promo->addCustomAttribute('123456', 'here is a custom field');
$promo->addSnippet('use array fields');
$promo->addSnippet('as arrays!');

// create an instance of the request handler
$handler = new Handler(array(
    'endpoint_id' => '12345',
    'user_id'     => 'foo',
    'password'    => 'bar'
    ));

// send it
$response = $handler->submit($promo);

Dynamic API

use Traction\Request\Competition;
use Traction\DynamicHandler;

// Create Entry
$comp = new Competition();
$comp->addAttribute('EMAIL', $entry->getEmail());
$comp->addAttribute('FIRSTNAME', $entry->getFirstName());
$comp->addAttribute('LASTNAME', $entry->getSurname());
$comp->addAttribute('LNDM_DATE_OF_BIRTH', $entry->getDob()->format('d/m/Y'));
$comp->addAttribute('LNDM_PHONE_NUMBER', $entry->getMobile());
$comp->addAttribute('LNDM_ADDRESS_1', $entry->getStreet());
$comp->addAttribute('LNDM_STATE_NAME', $entry->getState());
$comp->addAttribute('LNDM_SUBURB', $entry->getSuburb());
$comp->addAttribute('LNDM_POSTCODE', $entry->getPostcode());
$comp->setSubscribe($entry->getOptin());

// create an instance of the request handler
$handler = new DynamicHandler(array(
    'connection' => 'd2342afexxxadfas23r',
    'password'    => 'bar'
));

// send it
$response = $traction->submit($comp);
return $response->getCustomerId();

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-04-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固