-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconsole.php
More file actions
executable file
·42 lines (37 loc) · 1.08 KB
/
Copy pathconsole.php
File metadata and controls
executable file
·42 lines (37 loc) · 1.08 KB
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
42
#!/usr/bin/env php
<?php
require __DIR__ . '/vendor/autoload.php';
use Srvr\Command\Check;
use Srvr\Command\Fix;
use Srvr\Command\Install;
use Srvr\Command\SetApp;
use Srvr\Command\SetCron;
use Srvr\Command\TestEmail;
use Srvr\Console\PromptsConfig;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Dotenv\Dotenv;
// Sup .env vars. print_r($_ENV);
$dir = $_SERVER['PWD'];
$dotenv = new Dotenv();
$dotenv->load("{$dir}/.env");
if (file_exists("{$dir}/.env.local")) {
$dotenv->load("{$dir}/.env.local");
}
$input = new ArgvInput();
$output = new ConsoleOutput();
PromptsConfig::apply($input, $output);
// Symfony app.
$app = new Application('Console App', 'v1.0');
$app->addCommand(new Fix());
$app->addCommand(new Check());
$app->addCommand(new SetApp());
$app->addCommand(new Install());
$app->addCommand(new SetCron());
$app->addCommand(new TestEmail());
if ($_ENV['APP_TEMPLATE'] ?? FALSE) {
$app->setDefaultCommand($_ENV['APP_TEMPLATE'], TRUE);
}
// Run.
$app->run($input, $output);