trizz / directadmin
此包已被 弃用 并不再维护。未建议替代包。
与 DirectAdmin API 交互的基本包。
v0.0.1
2016-11-01 21:31 UTC
Requires
- php: >=5.6.0
Requires (Dev)
- phpunit/phpunit: 5.5.*
This package is not auto-updated.
Last update: 2022-04-02 06:24:39 UTC
README
此库提供了一个简单的 DirectAdmin 抽象类,可用于创建(简单)"组件",以消费 DirectAdmin API。
如何使用
使用此库有两种方式
不使用 composer
<?php // Include the required files. "DirectAdmin.php" is ALWAYS required. require_once '/path/to/library/src/DirectAdmin.php'; // After including the base class, you can load the components individually. require_once '/path/to/library/src/MailingList.php'; // Initialize the component. $daMailingList = new \Trizz\DirectAdmin\<COMPONENT>('http://<host>', '<username>', '<password>', '<domain>');
使用 composer
<?php // Make sure that the composer autoload file is loaded. In most cases this is already handled by your app. // Initialize the component. $daMailingList = new \Trizz\DirectAdmin\<COMPONENT>('http://<host>', '<username>', '<password>', '<domain>');
示例
存在一个名为 /examples
的目录,其中包含一些示例 PHP 文件。
可用的 "组件"
以下是当前可用的类。
通用方法
每个组件都提供了一些方法。
方法 | 描述 |
---|---|
setDomain($domain) |
更新要使用的域名。可用于切换到具有相同用户凭证的另一个域名。 |
邮件列表
此组件允许您管理 DirectAdmin 内部的可用邮件列表。可用方法
方法 | 描述 |
---|---|
lists() |
获取可用邮件列表的概览。 |
addList($name) |
添加新的邮件列表。 |
deleteList($name) |
删除邮件列表。 |
getSubscribers($listName, $subscriberType = all) |
获取指定列表的所有订阅者。$subscriberType 可以是:subscribers 或 digest_subscribers。默认返回两种类型。 |
addAddress($address, $list, $type = 'list') |
将单个电子邮件地址添加到指定的邮件列表。$type 可以是 "list" 或 "digest"。默认:list。 |
addAddresses($addresses, $list, $type = 'list') |
将多个电子邮件地址添加到指定的邮件列表。$type 可以是 "list" 或 "digest"。默认:list。 |
deleteAddress($address, $list, $type = 'list') |
从指定的列表中删除电子邮件地址。$type 可以是 "list" 或 "digest"。默认:list。 |
deleteAddresses($addresses, $list, $type = 'list') |
从指定的邮件列表中删除多个电子邮件地址。$type 可以是 "list" 或 "digest"。默认:list。 |