jimchen / script
Simple to write script in PHP.
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Type:project
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-12-18 06:11:56 UTC
README
Simple to write script in PHP.
Installing
$ composer create-project jimchen/script script --prefer-dist
Usage
Create a command file
$ cd script/
$ php artisan make:command HelloCommand // Create a file named `HelloCommand` in `app/Commands`
Write your command file
In 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!'); } }
Configuration
In 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, ]; ... }
License
MIT