professio / budgetmailer-php-api
Professio BudgetMailer API 客户端 for PHP
1.0.3
2017-01-23 08:56 UTC
Requires
- php: >=5.3.0
- ext-hash: *
- ext-json: *
- ext-sockets: *
This package is not auto-updated.
Last update: 2024-09-18 20:54:22 UTC
README
此存储库包含 PHP BudgetMailer API 客户端。使用此客户端,您必须有一个 BudgetMailer 账户。
需求
- PHP >= 5.3
- PHP 模块 HASH
- PHP 模块 JSON
- PHP 模块 Sockets
- BudgetMailer API 账户
安装
Composer
可以通过 Composer 轻松安装客户端。包名为:professio/budgetmailer-php-api
。
使用 composer 安装:composer require "professio/budgetmailer-php-api:1.0.*"
示例 composer.json
{
"require": {
"professio/budgetmailer-php-api": "1.0.*"
}
}
单个文件分发
您可以在 build/dist/budgetmailer-php-api.php
文件中找到包含合并类别的单个文件分发,您可以将它轻松包含到项目中,而无需使用 composer 或自动加载。
缓存
如果您想使用文件缓存,请确保缓存目录可由代码/ Web 服务器用户写入。同时,别忘了缓存目录绝对不能被 Web 用户访问。
配置
配置是以下配置指令的关联数组
$config = array(
// enable or disable cache
'cache' => true,
// cache directory (must be writeable, must end with /)
'cacheDir' => '/tmp/',
// api endpoint, please do not change this value, unless instructed to
'endPoint' => 'https://api.budgetmailer.com/',
// your API key
'key' => 'INSERTAPIKEY',
// name of the budgetmailer list you want to use as a default
'list' => 'INSERTLISTNAME',
// your API secret
'secret' => 'INSERTAPISECRET',
// advanced: socket timeout
'timeOutSocket' => 10,
// advanced: socket stream read timeout
'timeOutStream' => 10,
// cache time to live in seconds (3600 sec = 1 hour)
'ttl' => 3600,
);
运行
通过 Composer 安装客户端或作为单个文件分发版本包含/引入它。使用配置示例,并设置以下必需键
key
:API 密钥secret
:API 密钥list
:默认列表 ID 或名称
然后将配置传递给客户端
<?php
use BudgetMailer\Api\Client;
try {
$config = array(/* See configuration example */);
$client = Client::getInstance($config);
print $client->isConnected() ? 'Huray!' : 'Yay...';
} catch (\Throwable $e) {
print 'Something went wrong: ' . $e->getMessage();
}
示例
您可以在 build/examples/example.php
中找到涵盖大多数用例的更多示例。
文件概述
build/
:构建文件build/dist/
:单个文件分发build/docs/
:PHPDoc 相关文件build/examples/
:附加示例build/tests/
:PHPUnit 相关文件src/
:所有 PHP 类src/BudgetMailer/Api/
:所有 PHP API 客户端类src/BudgetMailer/Test/
:所有 PHPUnit 测试类.gitignore
:Gitignore 文件LICENSE
:MIT 许可证的全文README.md
:此文件composer.json
:Composer 包定义
版权
MIT 许可证
联系方式
- 电子邮件:info@budgetmailer.nl
- 网站:BudgetMailer
变更日志
1.0.3
(2017-01-19):- 添加了删除联系人批量测试缺失的测试
- 在配置示例中修复了缓存路径 + 更改了注释
- 在
*.xml.dist 文件
中修复了路径
1.0.2
(2016-12-13):- 添加了
build/docs/phpdoc.xml.dist
以用于 phpdocumentor - 向
\BudgetMailer\Api\Client\Http
添加了读取 http 头的方法 - 添加了新的批量方法:
\BudgetMailer\Api\Client::deleteContacts()
、\BudgetMailer\Api\Client::postContactsBulk()
、\BudgetMailer\Api\Client::postContactsUnsubscribe()
- 添加了一些缺失的方法和属性注释
- 更改了文件头以反映许可证变更
- 将许可证从 GPL2 更改为 MIT
- 更改测试以反映代码更改
- 客户端的
\BudgetMailer\Api\Client::deleteTag()
现在处理缺失的标签 - 修复了 composer.json(缺少 PHP 模块要求和不正确的许可证)
- 改进了
build/*.php
构建脚本(构建文档、单个文件分发、执行测试) - 将所有分发、文档、示例和测试移动到
build/
目录 - 质量保证变更(各种代码质量改进)
- 添加了
1.0.1
(2016-04-08):- 添加了
\BudgetMailer\Api\Client::$defaultConfig
和\BudgetMailer\Api\Client::getInstance()
以简化使用 - 将
dist/config.php
添加到.gitignore
并添加了dist/config.php.dist
文件 - 将缺少的尾部斜杠添加到
cacheDir
配置指令 - 增加了测试以反映更改
- 修复了
缓存
问题(始终是禁用状态) - 改进了构建脚本
dist/build.php
- 将composer包名称从
professio/php-budgetmailer
重命名为professio/budgetmailer-php-api
- 添加了
1.0.0
(2015-09-24):- 初始版本