Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

222
Visualizações
Is there a version of laravel for console app only?

Currently I am using Symfony console for my terminal apps but I found Laravel artisan console has a lot of features out of the box that I can use. Is there a version of Laravel that has no other command used for developing web apps? or at least to remove default available commands that are registered when you install Laravel?

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I've just got this working using illuminate/console:

composer.json:

{
    "require": {
        "illuminate/console": "^5.4",
        "illuminate/container": "^5.4",
        "illuminate/events": "^5.4"
    },
    "autoload": {
        "psr-4": {"Yourvendor\\Yourproject\\": "src/"}
    }
}

your-console-app (replacement for artisan):

#!/usr/bin/env php
<?php

use Illuminate\Console\Application;
use Illuminate\Container\Container;
use Illuminate\Events\Dispatcher;

use Yourvendor\Yourproject\Console\Commands\Yourcommand;

if (file_exists($a = __DIR__.'/../../autoload.php')) {
    require_once $a;
} else {
    require_once __DIR__.'/vendor/autoload.php';
}

$container = new Container;
$dispatcher = new Dispatcher;
$version = "5.4"; // Laravel version

$app = new Application($container, $dispatcher, $version);

$app->add(new Yourcommand);

$app->run();

src/Console/Commands/Yourcommand.php:

<?php

namespace Yourvendor\Yourproject\Console\Commands;

use Illuminate\Console\Command;

class Yourcommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'yourcommand:test {test}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Yourcommand test';

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $this->info('Hello world!');
    }
}

Run the console command using:

php your-console-app yourcommand:test

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda