apli/integration-rdstation 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

apli/integration-rdstation

Composer 安装命令:

composer require apli/integration-rdstation

包简介

Aplí RDStation Client Library

README 文档

README

A simple package to integrate your application with RD Station Marketing using oauth authentication.

Requirements

The following versions of PHP are supported.

  • PHP 7.3

Basi Usage

Create a provide instance in yours controller constructor

use Apli\Integration\RdStation\Provider\RdStation;

$this->oauthProvider = new RdStation([
    'clientId'          => Env::get('RDSTATION_CLIENT_ID'),
    'clientSecret'      => Env::get('RDSTATION_CLIENT_SECRET'),
    'redirectUri'       => url('auth/rdstation/callback'),
]);

In authorization route call provider authorize method

$this->oauthProvider->authorize();

In callback route call getAccessToken:

use Apli\OAuth2\Client\Auth\Tokens\AccessTokenInterface;
use Apli\OAuth2\Client\Support\Utils\GrantType;

/** @var AccessTokenInterface $accessToken */
$accessToken = $this->oauthProvider->getAccessToken(GrantType::AUTHORIZATION_CODE, [
    'code' => $request->get('code')
]);

Resource Owner

To request RDStation data like contacts or updating funnels/event you need a ResourceOwner instance. This object is a representation of rdstation authorized account.

use Apli\Integration\RdStation\Provider\RdStationAccount;

$rdstationAccount = $this->oauthProvider->getResourceOwner($accessToken);

Contacts

$contact = $rdstationAccount->contacts()->getByIdentifier('email@domain.com');

or you can use uuid

$contact = $rdstationAccount->contacts()->getByIdentifier('11111111-1111-1111-1111-111111111111');

To update a contact

$contact->setJobTitle('Developer');
$contact->getAddress()->setState('SP');
$contact->getPhone()->setMobilePhone('9876543210');
$contact->getSocialNetwork()->setTwitter('teste');
$rdstationAccount->contacts()->patch($contact);

Funnels

$funnel = $rdstationAccount->funnels()->getByIdentifier('email@domain.com');

// or you can use uuid

$funnel = $rdstationAccount->funnels()->getByIdentifier('11111111-1111-1111-1111-111111111111');

To update a funnel

use Apli\Integration\RdStation\Entities\Funnel;

$funnel->setLifecycleStage(Funnel::STAGE_LEAD);
$rdstationAccount->funnels()->put('email@domain.com', $funnel);

// or you can use uuid

$rdstationAccount->funnels()->put('11111111-1111-1111-1111-111111111111', $funnel);

Events

use Apli\Integration\RdStation\Entities\Event;

$event = new Event(
    Event::FAMILY_CDP,
    Event::TYPE_CONVERSION, 
    [
        'conversion_identifier' => 'conversionName',
        'email' => 'email@domain.com'
    ]
);
$rdstationAccount->events()->post($event);

Persisting Access Token

You can save access token data in a database to reuse, for that we provide a toArray() method

$accessTokenData = $accessToken->toArray()

// response:
// [
//     "access_token" => "xxxx",
//     "refresh_token" => "xxxxx",
//     "expires" => 1574799849,
//     "grant_type" => "Authorization",
//     "provider_name" => "rdstation"
// ]

Restore Access Token Object

To restore access token object:

use Apli\OAuth2\Client\Auth\Tokens\AccessToken;

$accessToken = new AccessToken($accessTokenData);

apli/integration-rdstation 适用场景与选型建议

apli/integration-rdstation 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 220 次下载、GitHub Stars 达 1, 最近一次更新时间为 2019 年 11 月 26 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「api」 「Authentication」 「client」 「oauth」 「oauth2」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 apli/integration-rdstation 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 apli/integration-rdstation 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-11-26