Laravel 中的 Artisan 命令行是这样
// 创立命令php artisan make:command SendEmails// 运行命令php artisan mail:send// 应用参数php artisan mail:send hello// 应用选项php artisan mail:send --mail=abc@qq.com
Goravel 中的 Artisan 命令行也一样
// 创立命令go run . artisan make:command SendEmails// 运行命令go run . artisan mail:send// 应用参数go run . artisan mail:send hello// 应用选项go run . artisan mail:send --mail abc@qq.com
就连 struct 的定义都是满满的回顾:
package commandsimport ( "github.com/goravel/framework/contracts/console" "github.com/urfave/cli/v2")type SendEmails struct {}//Signature The name and signature of the console command.func (receiver *SendEmails) Signature() string { return "emails"}//Description The console command description.func (receiver *SendEmails) Description() string { return "Command description"}//Extend The console command extend.func (receiver *SendEmails) Extend() console.CommandExtend { return console.CommandExtend{}}//Handle Execute the console command.func (receiver *SendEmails) Handle(c *cli.Context) error { return nil}
相熟的配方,原来的滋味。PHPer 极速切换,Goer 的福音。 欢送 star 与 issues。
对于 Goravel
Goravel 是一个性能齐备、具备良好扩大能力的 Web 应用程序框架。 作为一个起始脚手架帮忙 Golang 开发者疾速构建本人的利用。
我的项目地址:https://github.com/goravel/goravel
文档地址:www.goravel.dev