承接 contee/php-sdk 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

contee/php-sdk

Composer 安装命令:

composer require contee/php-sdk

包简介

Conteeapp PHP sdk.

README 文档

README

Software development kit for Contee service. Allows to send newsletters, working with matched data and accessing API routes.

Instalation

Sdk is developed as composer package. To instal just run:

composer install

To access API routes, that require authorization you have to pass client_id and client_secret credentials by app_id parameter.

$contee = new Contee\Contee(new Contee\Auth\ApiAuth("app_id", "client_id", "client_secret"));

Accessing API route

Api routes are currently allowed from Pro plan. Sdk has method for accessing them. When the route has an option you can pass the parameter in options array and it will be automatically replaced. Every api call returns Contee\Response\Response object, which has methods to get content back as raw output, json string, array or object.

$contee->get("/site/visits/:option, array(":option"=>"perpage"))->toObject();

Serving content

To match the right content for every one of your customers and rise your earns we need to get it first. The easiest way to do this is use this Sdk. Returns Contee\Response\Response which has methods to display as mentoied above.

$matched = $contee->createMatched();

$item = $contee->createItem();
$item->setTags(array("tag1", "tag2", "tag3")); //required item to correctly matching
$item->setData(array("name"=>"FOO")); //whatever data you want to get back and display

$matched->setItem($item);
$matched->setResource("email@service.com"); //if resource is not passed contee cookie is used or blank

$contee->getMatched($matched)->toObject();

Emails

Matched emails are similar than the way of serving content mentoied above. Each of thoose emails has content perfectly matched for everyone of your customers. This funcionality requires authorization with client_id and client_secret.

$newsletter = $contee->createNewsletter();

$item = $contee->createItem();
$item->setTags(array("tag1", "tag2", "tag3")); //required item to correctly matching
$item->setData(array("name"=>"FOO")); //you can access this data in email template.

$message = $contee->createMessage();
$message->setCustom(array("message" => "Hi there."));
$message->setFromEmail("mail@server.com");
$message->setFromName("Jhon Doe");
$message->setReplyTo("mail@server.com");
$message->setSubject("Whatever subject you want.");
$message->setRecipients(array("recipient@server.com", "another@server.com"));
$message->setTemplate("basic"); //layout must be uploaded and selected.

$newsletter->setMessage($message);
$newsletter->setItem($item);

$contee->sendNewsletter($newsletter)->toObject();

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-01-19