https://github.com/rakit/console
PHP Simple Library to Create Command Line Interface Application
https://github.com/rakit/console
Last synced: 5 months ago
JSON representation
PHP Simple Library to Create Command Line Interface Application
- Host: GitHub
- URL: https://github.com/rakit/console
- Owner: rakit
- Created: 2017-02-22T11:56:13.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-03-09T14:21:58.000Z (over 8 years ago)
- Last Synced: 2024-08-08T15:22:07.146Z (almost 2 years ago)
- Language: PHP
- Size: 14.6 KB
- Stars: 6
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Rakit Console
=======================
Rakit Console is simple PHP library to create Command Line Interface (CLI) Application.
This library strongly inspired by [Laravel Artisan Console](https://laravel.com/docs/5.4/artisan).
## 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:
```bash
composer require rakit/console
```
## Quickstart
#### 1. Create App
Create a file named `cli` (without extension).
```php
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
```