digitaladditive/exacttarget-laravel
使用超文本预处理器与Exact Target沟通的最佳方式
2.4
2019-03-01 00:15 UTC
Requires
- php: ^7.1.3
- digitaladditive/php-fuel-sdk-fork: >=1.2
- guzzlehttp/guzzle: ~6.0
- illuminate/support: ~5.0
- symfony/dotenv: ^4.2
Requires (Dev)
- filp/whoops: ^2.0
- fzaninotto/faker: ^1.4
- laravel/homestead: ^3.0
- mockery/mockery: ^1.0
- nunomaduro/collision: ^2.0
- phpunit/phpunit: ^7.0
- 2.4
- 2.3
- 2.2
- v2.1.1
- v2.1
- v2.0.1
- v2.0
- 1.0.1.5
- 1.0.1.4
- 1.0.1.3
- 1.0.1.2
- v1.0.1.1
- 1.0.1
- v1.0.0
- dev-return-error-upsertrowset
- dev-rest-method-portfolio
- dev-vacoda-version
- dev-release/1.0.2
- dev-patch/while-loop-getrows
- dev-implements-databroadcast-event
- dev-implement-new-fuel-sdk
- dev-hotfix/getResults
- dev-develop
This package is not auto-updated.
Last update: 2024-09-28 17:28:10 UTC
README
这个Laravel包提供了一套方法,用于干净且易于与全新的Exact Target REST API以及与Fuel SDK一起使用的方法进行交互。
它实现了以下合同,解释了目前在您的控制器或模型中可用的内容。您只需查看注释,就可以了解每个方法的功能。这是一个正在进行中的工作,还有许多端点需要创建方法。
此构建包括一个针对Laravel的实现。
<?php interface EtInterface { /** * reaches out to Exact Target Rest API with client secret and Id * returns the auth token * * Client is the guzzle object and all the methods you need * * @param $clientId * @param $clientSecret * @param $getTokenUri * @param Client $client * @return array */ public function getToken($clientId, $clientSecret, $getTokenUri); /** * POST * * /dataevents/key:{key}/rowset * * Upserts a batch of data extensions rows by key. * * @param $keys * @param $values * @param Client $client * @return array */ public function upsertRowset($values, $deKey); /** * SOAP WDSL * * uses the Fuel SDK to delete a row by Primary Key * currently the v1 of the REST api does not support retrieval of data. * Hopefully this will change in the near future * * @param $deName * @param $props * @return array -- the response from Exact Target */ public function deleteRow($deName, $props); /** * @param $deName * Required -- Name of the Data Extension to query * * @return array */ public function getDeColumns($deName); /** * SOAP WDSL * * uses the Fuel SDK to grab all the rows of a given Data Extension * currently the v1 of the REST api does not support retrieval of data. * Hopefully this will change in the near future * * * @param $keyName * This is an optional param if set along with primaryKey the result will be filtered to a single row by PrimaryKey * @param $primaryKey * This is an optional param if set along with keyName the result will be filtered to a single row by PrimaryKey * @param $deName * Required -- Name of the Data Extension to query * @return array * Response from ET */ public function getRows($deName, $keyName='', $primaryKey=''); /** * POST * * Asynchronously upserts a batch of data extensions rows by key. * * these async methods need testing when / if we have a need for async requests (which we will) * * /dataeventsasync/key:{key}/rowset * */ public function asyncUpsertRowset($keys, $values, $deKey); /** * PUT * * Upserts a data extension row by key. * * /dataevents/key:{key}/rows/{primaryKeys} */ public function upsertRow($pKey, $pVal, $values, $deKey); /** * PUT * * Asynchronously upserts a data extension row by key. * * these async methods need testing when / if we have a need for async requests (which we will) * * /dataeventsasync/key:{key}/rows/{primaryKeys} */ public function asyncUpsertRow($pKey, $pVal, $values, $deKey); /** * Create a Data extension by passing an array of DE Name keys => Column props values. * * @param $deStructures * @return array (response) */ public function createRow($deName, $props); /** * POST * * To validate an email address, perform an HTTP POST specifying the email address and validators * to be used in the payload of the HTTP POST. You can use more than one validator in the same call. * * /validateEmail * */ public function validateEmail($email); /** * Create a Data extension by passing an array of DE Name keys => Column props values. * * @param $deStructures * @return array (response) */ public function createDe($deStructures) }
安装
首先,通过Composer安装此包。编辑您的项目composer.json
文件,添加digitaladditive/exacttargetlaravel
依赖项。或者直接运行composer require digitaladditive/exacttargetlaravel
。
"require-dev": {
"digitaladditive/ExactTargetLaravel": "~1.1"
}
接下来,在终端中更新Composer。
composer update --dev
接下来,您需要在位于此包根目录下的ExactTargetLaravelConfig.php文件中填写您的Exact Target API凭据(CLIENT_ID和CLIENT_SECRET)。
确保您的Web服务器上已安装并启用了'mcrypt',否则Fuel SDK调用将失败。
现在,只需在Laravel应用文件顶部添加一个使用声明,如下所示:
use digitaladditive/ExactTargetLaravel/LaravelEtApi;
用法
一些用法示例
<?php /* asynchronously upsert a batch of Rows to a DE*/ return $this->etConnect()->asyncUpsertRowset(["primaryKey" => 1], ["emailAddress" => "newemail@newemail.com"], 'TestingRest '); /* upsert a single row to a DE */ return $this->etConnect()->upsertRow('primaryKey', 1, ['emailAddress' => 'oncemore@oncemore.com'], 'TestingRest'); /* Validate an Email address */ return $this->etConnect()->validateEmail('patrickisgreat@gmail.com'); /* Delete a Row from a DE */ return $this->etConnect()->deleteRow('TestingRest', ['primaryKey' => 1]);