You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use the package manager [composer](https://getcomposer.org/) to install DirectApi.
6
+
```bash
7
+
composer require avametix/directapi
8
+
```
9
+
10
+
## Usage
11
+
12
+
```php
13
+
use Avametix\DirectApi;
14
+
15
+
// Create a new DirectApi instance logged in with user "username" and password "password"
16
+
$directapi = new DirectApi(
17
+
'da.domain.io',
18
+
'username',
19
+
'password',
20
+
'https',
21
+
2222
22
+
);
23
+
24
+
// Get user domains
25
+
$domains = $directapi->get("SHOW_DOMAINS");
26
+
27
+
if ($domains === false) {
28
+
die(
29
+
"Something went wrong fetching domains for username,<br/>
30
+
are you using the right password?"
31
+
);
32
+
}
33
+
34
+
foreach ($domain in $domains) {
35
+
echo $domain . "<br/>";
36
+
}
37
+
38
+
// Log-in as user via reseller (directapi is initialised with reseller or admin login)
39
+
$directapi->login_as('clientuser');
40
+
41
+
// ...
42
+
43
+
$directapi->logout();
44
+
```
45
+
46
+
All DirectAdmin API commands can be found in the [DirectAdmin documentation](https://www.directadmin.com/api.php).
47
+
48
+
## Contributing
49
+
Contributions are primarily made by members of [Avametix](https://avametix.com), however pull requests are welcome. Planning a major change? Please open an issue first and discuss your changes.
50
+
51
+
## License
52
+
[GNU General Public License](https://choosealicense.com/licenses/gpl-3.0/)
0 commit comments