PHP code example of webman-tech / laravel-console

1. Go to this page and download the library: Download webman-tech/laravel-console library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

webman-tech / laravel-console example snippets


return [
    'commands_path' => [
         app_path() . '/myCommands' => 'app\myCommands',
    ],
];

return [
    'commands' => [
        \App\Commands\MyCommand::class,
    ],
];

namespace app\command;
 
use Illuminate\Console\Command;
 
class SendEmails extends Command
{
    protected $signature = 'mail:send {userId}';
 
    protected $description = 'Send a marketing email to a user';
 
    public function handle(Mailer $mailer): void
    {
        $mailer->send(User::find($this->argument('userId')));
    }
}

use \WebmanTech\LaravelConsole\Facades\Artisan;

Artisan::call('mail:send', ['userId' => 1]);
bash
php artisan mail:send 1