use Symfony\Component\Console\Output\ConsoleOutput; $autoLoader = (require __DIR__ . '/bootstrap/autoload.php'); $app = (require_once __DIR__ . '/bootstrap/app.php'); Application::$loader =& $autoLoader; ConsoleApplication::setOutput(new ConsoleOutput()); ConsoleApplication::setInput(new \Symfony\Component\Console\Input\ArgvInput()); /* |-------------------------------------------------------------------------- | Run The Artisan Application |-------------------------------------------------------------------------- | | When we run the console application, the current CLI command will be | executed in this console and the response sent back to a terminal | or another output device for the developers. Here goes nothing! | */ $kernel = $app->make('Illuminate\\Contracts\\Console\\Kernel'); $kernel->bootstrap(); $status = $kernel->handle(ConsoleApplication::getInput(), ConsoleApplication::getOutput()); /* |-------------------------------------------------------------------------- | Shutdown The Application |-------------------------------------------------------------------------- | | Once Artisan has finished running. We will fire off the shutdown events | so that any final work may be done by the application before we shut | down the process. This is the last thing to happen to the request. | */ $kernel->terminate(ConsoleApplication::getInput(), $status); exit($status);
/** * Builds the package template. */ public function build() { $output = Application::getOutput(); $input = Application::getInput(); $this->package->setRendererInstance($this->generator->getRenderer()); $this->package->setApplication(app(Application::class)); $this->package->setOutputInstance($output); $this->package->setInputInstance($input); $this->package->builderLoaded(); if ($this->getCommonTemplateDirectory() !== null) { $this->generator->getRenderer()->addPath($this->getCommonTemplateDirectory()); } $this->generator->setVerbatimExcludePatterns($this->package->getVerbatimExcludePatterns()); $this->generator->setVerbatimPatterns($this->package->getVerbatimPatterns()); foreach ($this->package->getTransformPaths() as $pathKey => $processPath) { $this->generator->getPathManager()->getCollector()->addFileNames([$this->normalizePath($pathKey) => $this->normalizePath($processPath)]); } foreach ($this->package->getIgnoredPaths() as $ignoredPath) { $this->generator->getPathManager()->getGenerator()->addIgnoredPath($this->normalizePath($ignoredPath)); } foreach ($this->package->getPathsToRemove() as $pathToRemove) { $this->generator->getPathManager()->getGenerator()->addAutomaticallyRemovedPath($this->normalizePath($pathToRemove)); } $this->generator->addPaths((array) $this->getTemplateDirectory()); $this->generator->generateContent($this->outputDirectory); }