jimchen / script
简单编写PHP脚本。
v1.0.0
2018-10-17 15:19 UTC
Requires
- php: >=7.0
- illuminate/console: ~5.5
- illuminate/container: ~5.5
- illuminate/events: ~5.5
- illuminate/filesystem: ~5.5
- symfony/finder: ~3.3
This package is auto-updated.
Last update: 2024-09-18 05:40:25 UTC
README
简单编写PHP脚本。
安装
$ composer create-project jimchen/script script --prefer-dist
使用
创建命令文件
$ cd script/
$ php artisan make:command HelloCommand // Create a file named `HelloCommand` in `app/Commands`
编写您的命令文件
在 app/Commands/HelloCommand.php
<?php namespace App\Commands; use Illuminate\Console\Command; class HelloCommand extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'test'; /** * The console command description. * * @var string */ protected $description = 'A test command'; /** * Create a new command instance. * * @return void */ public function __construct() { parent::__construct(); } /** * Execute the console command. * * @return mixed */ public function handle() { // $this->info('Hello World!'); } }
配置
在 app/Kernel.php
<?php namespace App; use App\Foundation\Console\Kernel as ConsoleKernel; class Kernel extends ConsoleKernel { /** * The Artisan commands provided by your application. * * @var array */ protected $commands = [ \App\Commands\HelloCommand::class, ]; ... }
许可证
MIT