Home API Tools Posts Hire Me About
Sign In Create Account
Laravel

Laravel Artisan Custom Commands

January 16, 2026 1 min read 15 views

Custom Artisan commands:

Create Command

php artisan make:command SendEmails

Command Class

class SendEmails extends Command
{
    protected $signature = \'emails:send {user} {--queue}\';
    protected $description = 'Send emails to user';

    public function handle()
    {
        $userId = $this->argument('user');
        $queue = $this->option('queue');
        
        $this->info('Sending emails...');
        $this->line('Done!');
    }
}

Interactive Input

$name = $this->ask('What is your name?');
$confirmed = $this->confirm('Continue?');
$choice = $this->choice('Select', ['a', 'b']);
Share this post:

Related Posts

Comments (0)

Please log in to leave a comment. Log in

No comments yet. Be the first to comment!