trizz / directadmin
This package is abandoned and no longer maintained.
No replacement package was suggested.
A basic package to interact with the 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
This library provides a simple abstract DirectAdmin class that can be used to create (simple) "components" to consume the DirectAdmin API.
How to use
There are two ways to use this library:
Without 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>');
With 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
There's a directory called /examples
that contains some example PHP files.
Available "components"
Below are the currently available classes.
General methods
There are some several methods that are available in every component.
Method | Description |
---|---|
setDomain($domain) |
Update the domain to use. Can be used to switch to another domain with the same user credentials. |
MailingList
This component allows you to manage the available mailing lists inside DirectAdmin. Available methods:
Method | Description |
---|---|
lists() |
Get an overview of the available mailing lists. |
addList($name) |
Add a new mailing list. |
deleteList($name) |
Remove a mailing list. |
getSubscribers($listName, $subscriberType = all) |
Get all subscribers for the specified list. The $subscriberType can be: subscribers or digest_subscribers. By default both types are returned. |
addAddress($address, $list, $type = 'list') |
Add a single email address to the specified mailing list. $type Can be "list" or "digest". Default: list. |
addAddresses($addresses, $list, $type = 'list') |
Add multiple email addresses to the specified mailing list. $type Can be "list" or "digest". Default: list. |
deleteAddress($address, $list, $type = 'list') |
Delete an email address from the specified list. $type Can be "list" or "digest". Default: list. |
deleteAddresses($addresses, $list, $type = 'list') |
Delete multiple email addresses from the specified mailing list. $type Can be "list" or "digest". Default: list. |