-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathapp.php
37 lines (27 loc) · 926 Bytes
/
app.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
<?php
require 'vendor/autoload.php';
use Slim\Slim;
use Symfony\Component\Yaml\Yaml;
use RouterOsStumbler\Entity\Ubiquiti;
use RouterOsStumbler\Entity\Routerboard;
require 'bootstrap/database.php';
$deviceConfig = Yaml::parse(file_get_contents(__DIR__ . '/config/devices.yml'));
$devices = [];
foreach ($deviceConfig['devices'] as $device) {
switch ($device['type']) {
case 'routerboard':
$devices[$device['name']] = new Routerboard($device['name'], $device['host'], $device['username'], $device['password']);
break;
case 'ubiquiti':
$devices[$device['name']] = new Ubiquiti($device['name'], $device['host'], $device['username'], $device['password']);
break;
}
}
session_cache_limiter(false);
session_start();
$app = new Slim([
'templates.path' => '../templates',
'view' => new \Slim\Views\Twig(),
]);
require 'routes.php';
$app->run();