audiens/adform-client
最新稳定版本:1.1.5
Composer 安装命令:
composer require audiens/adform-client
包简介
PHP client for adform API
README 文档
README
A PHP client library for AdForm's DMP API.
Installation Using Composer
$ composer require Audiens/adform-client
Available endpoints
The current implementation covers the following endpoints:
Usage
require 'vendor/autoload.php'; $username = '{yourUsername}'; $password = '{yourPassword}'; try { $adform = new Audiens\AdForm\Client($username, $password); } catch (Audiens\AdForm\Exception\OauthException $e) { exit("Auth failed with message: ".$e->getMessage()); } // Get 10 categories $categories = $adform->categories()->getItems(10); foreach ($categories as $category) { echo $category->getName()."\n"; } // create a new category $category = new Audiens\AdForm\Entity\Category(); $category->setName('Test') ->setDataProviderId(10000); $category = $adform->categories()->create($category);
More examples are available in the examples dir.
Cache
The package has an optional ability to cache the API call locally. Two cache drivers are available, Redis and File.
require 'vendor/autoload.php'; $username = '{yourUsername}'; $password = '{yourPassword}'; // Redis driver try { $redisConfig = [ 'scheme' => 'tcp', 'host' => '192.168.10.10', 'port' => 6379, ]; $cacheRedis = new Audiens\AdForm\Cache\RedisCache($redisConfig); $adformRedis = new Audiens\AdForm\Client($username, $password, $cacheRedis); } catch (Audiens\AdForm\Exception\OauthException $e) { exit("Auth failed with message: ".$e->getMessage()); } // File driver try { $path = '/path/to/your/cache/dir' $cacheFile = new Audiens\AdForm\Cache\FileCache($path); $adformFile = new Audiens\AdForm\Client($username, $password, $cache); } catch (Audiens\AdForm\Exception\OauthException $e) { exit("Auth failed with message: ".$e->getMessage()); }
License
The MIT License (MIT). Please see LICENSE for more information.
统计信息
- 总下载量: 19.91k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-11-02