jimchen/script

Simple to write script in PHP.

Maintainers

👁 jimchen

Package info

github.com/JimChenWYU/script

Type:project

pkg:composer/jimchen/script

Statistics

Installs: 6

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

v1.0.0 2018-10-17 15:19 UTC

Requires (Dev)

None

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 9493f9a64520b07630d10386e9e566131ce2f642

  • JimChen <18219111672.woop@163.com>

This package is auto-updated.

Last update: 2026-06-18 09:08:28 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