rakit/console
最新稳定版本:v0.1.3
Composer 安装命令:
composer require rakit/console
包简介
PHP Simple Library to Create Command Line Interface Application
README 文档
README
Rakit Console is simple PHP library to create Command Line Interface (CLI) Application. This library strongly inspired by Laravel Artisan Console.
Features
- Closure command. You don't need to create class for simple command.
- Built-in command
list. - Auto help handler for each commands.
- Easy command signature.
- Password input.
- Simple Coloring.
Installation
Just run this composer command:
composer require rakit/console
Quickstart
1. Create App
Create a file named cli (without extension).
<?php use Rakit\Console\App; require('vendor/autoload.php'); // 1. Initialize app $app = new App; // 2. Register commands $app->command('hello {name}', 'Say hello to someone', function($name) { $this->writeln("Hello {$name}"); }); // 3. Run app $app->run();
2. Running Command
Open terminal/cmd, go to your app directory, run this command:
php cli hello "John Doe"
3. Command List
You can see available commands by typing this:
php cli list
4. Show Help
You can show help by putting --help or -h for each command. For example:
php cli hello --help
统计信息
- 总下载量: 1.38k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 0
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-02-22