sleiman/addcontext-php
Composer 安装命令:
composer require sleiman/addcontext-php
包简介
PHP wrapper to connect with AddContext.io API and save context snapshots based on events/actions
README 文档
README
A PHP wrapper for the AddContext API. Feedback or bug reports are appreciated.
Get started
Installation
If you're using Composer, you can run the following command:
composer require sleiman/addcontext-php
You can also download them directly and extract them to your web directory.
Add the wrapper to your project
If you're using Composer, run the autoloader
require 'vendor/autoload.php';
Or include the Addcontext.php file
include('../src/Addcontext.php');
Initialize the class
use \TANIOS\Addcontext\Addcontext; $addcontext = new Addcontext(array( 'access_token' => 'ACCESS_TOKEN', ));
Create new snapshot request
We want to create a new entry in the system via the API
// Add any metadata you want to associate to that snapshopt to an array
$metadata['text_main_entity'] = 'russia'; $metadata['sent_from'] = 'iphone'; $metadata['tweet_id'] = '123213213'; $metadata['tweet_content'] = 'messsage text'; // Add all the information you have to an array (email, datetime and rule are mandatory) // Add the metada array to the fields array $fields = array( 'email' => "someletters@youcanread.com", 'datetime'=> "2018-03-01 19:08:00", 'rule' => 'trump tweeted', 'metadata'=> $metadata ); // Create the snapshot $new_snapshot = $addcontext->createSnapshotRequest($fields);
Credits
Copyright (c) 2018 - Programmed by Sleiman Tanios
统计信息
- 总下载量: 10
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-04-14