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
use WebmanTech\LaravelConsole\Facades\Artisan;
// 调用命令
Artisan::call('mail:send', [
'userId' => 123
]);
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(): void
{
// 处理逻辑
}
}
use WebmanTech\LaravelConsole\Facades\Artisan;
Artisan::call('mail:send', ['userId' => 1]);
bash
php artisan mail:send 1
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.