forked from cschalenborgh/laravel-directadmin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.php
41 lines (35 loc) · 1.04 KB
/
start.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
/**
* laravel-directadmin
*
* Laravel bundle to access the DirectAdmin API
*
* @author Chris Schalenborgh <chris.s@kryap.com>
* @version 0.1
* @package laravel-directadmin
* @link http://www.directadmin.com/api.html
* @license BSD License
*/
// configure autoloader
Autoloader::map(array(
//'directadmin' => Bundle::path('directadmin') . 'lib' .DS . 'DirectAdmin.php',
'HTTPSocket' => Bundle::path('directadmin') . 'lib' .DS . 'DirectAdmin.php',
));
// Register a mailer in the IoC container
IoC::singleton('DirectAdmin', function()
{
// instantiate new directadmin
$sock = new HTTPSocket;
// load settings
$config = Config::get('directadmin::settings', array());
// set host/port
if(!Empty($config['host']) && !Empty($config['port'])) {
$sock->connect($config['host'], $config['port']);
}
// set login/password
if(!Empty($config['login']) && !Empty($config['password'])) {
$sock->set_login($config['login'], $config['password']);
}
// Return the instance.
return $sock;
});