isDir()) { continue; } $builder->addDefinitions($file->getRealPath()); } } $container = $builder->build(); $app = new Application($container); $folder = implode(DIRECTORY_SEPARATOR, [__DIR__, 'commands']); if (file_exists($folder)) { $files = new DirectoryIterator($folder); foreach ($files as $file) { if ($file->isDir() or $file->getExtension() != 'php') { continue; } include_once $file->getRealPath(); } } return $app;