Skip to content

Commit 93a52c4

Browse files
author
Roël Couwenberg
committed
Update README.md
1 parent 0938a3e commit 93a52c4

1 file changed

Lines changed: 51 additions & 1 deletion

File tree

README.md

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,52 @@
11
# DirectApi
2-
An API wrapper for the DirectAdmin API.
2+
DirectApi is a wrapper for the DirectAdmin API.
3+
4+
## Installation
5+
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

Comments
 (0)