audiens / adform-client
adform API的PHP客户端
该软件包的官方仓库似乎已不存在,因此该软件包已被冻结。
1.1.5
2020-04-27 16:16 UTC
Requires
- php: >=7.1
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^6.3
- league/flysystem: ^1.0
- league/oauth2-client: ^1.4
- myclabs/php-enum: ^1.6
- predis/predis: ^1.1
Requires (Dev)
- jangregor/phpstan-prophecy: *
- php-coveralls/php-coveralls: ^2.1
- phpstan/phpstan: ~0.11
- phpstan/phpstan-deprecation-rules: *
- phpstan/phpstan-php-parser: ^0.11.0
- phpstan/phpstan-phpunit: *
- phpunit/phpunit: ^7.4
- ramsey/uuid: ^3.8
- slevomat/coding-standard: ^4.6
- squizlabs/php_codesniffer: ^3.3
- vlucas/phpdotenv: ^2.5
README
这是一个用于AdForm DMP API的PHP客户端库。
使用Composer安装
$ composer require Audiens/adform-client
可用端点
当前实现涵盖了以下端点
使用
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);
更多示例可以在examples目录中找到。
缓存
该软件包具有可选的本地缓存API调用的能力。提供两种缓存驱动器,Redis和文件。
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()); }
许可
MIT许可(MIT)。有关更多信息,请参阅LICENSE。