41 lines
1015 B
PHP
41 lines
1015 B
PHP
#!/usr/bin/env php
|
|
<?php
|
|
|
|
use Symfony\Component\Console\Application;
|
|
|
|
|
|
set_time_limit(0);
|
|
|
|
/**
|
|
* Loading path constant
|
|
*/
|
|
define('DS', DIRECTORY_SEPARATOR);
|
|
define('ROOT', dirname(__FILE__));
|
|
|
|
function findCommandClasses($directory)
|
|
{
|
|
$commandClasses = [];
|
|
$files = glob($directory . '/*.php');
|
|
foreach ($files as $file) {
|
|
$commandClasses[] = basename($file, '.php');
|
|
}
|
|
return $commandClasses;
|
|
}
|
|
|
|
/**
|
|
* Enable autoload
|
|
*/
|
|
require_once ROOT . DIRECTORY_SEPARATOR . 'vendor'. DIRECTORY_SEPARATOR . 'autoload.php';
|
|
|
|
// start application
|
|
$kapp = new \Kletellier\Framework\Core\Kernel\Application(ROOT);
|
|
|
|
$application = new Application();
|
|
// Load all commands in Commands folder
|
|
$command_directory = ROOT . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . "Commands";
|
|
$commandClasses = findCommandClasses($command_directory);
|
|
foreach ($commandClasses as $commandClass) {
|
|
$clsname = "App\\Commands\\$commandClass";
|
|
$application->add(new $clsname());
|
|
}
|
|
$application->run(); |