PHPackages                             hasan-22/php-command - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. hasan-22/php-command

ActiveLibrary[CLI &amp; Console](/categories/cli)

hasan-22/php-command
====================

Creating custom commands by PHP

v1.0.0(3y ago)1101MITPHPPHP &gt;=7.4

Since Feb 2Pushed 3y ago1 watchersCompare

[ Source](https://github.com/HASSAN-22/php-command)[ Packagist](https://packagist.org/packages/hasan-22/php-command)[ Docs](https://github.com/HASSAN-22/php-command)[ RSS](/packages/hasan-22-php-command/feed)WikiDiscussions main Synced yesterday

READMEChangelog (1)DependenciesVersions (2)Used By (0)

PHP command line
----------------

[](#php-command-line)

### Creating custom commands by PHP language With this package, you can easily create a command line script

[](#creating-custom-commands-by-php-language-with-this-package-you-can-easily-create-a-command-line-script)

Install
-------

[](#install)

```
composer require hasan-22/php-console
```

Usage:
------

[](#usage)

Create a command

```
use App\Console;

Console::command('command_name',function (){

})->purpose('Command description');

// purpose method is optional

// Run it like this
// php [scriptName.php] [command_name] [args]
```

---

Get input from user

```
Console::command('get_username',function (){
    $input = Console::input('Enter your name: ');
    echo $input;
})->purpose('This command gets the username');

// Run:
// php script.php get_username
```

---

Secret input

```
Console::command('get_password',function (){
    $input = Console::secretInput('Enter your password:');
    echo $input;
});

// Run:
// php script.php get_password
```

---

Get arguments for command line

```
Console::command('get_password',function (){
    $input = Console::option('--pass');
    echo $input;
});
// Run:
// php script.php get_password --pass 123456

// Output: 123456

##################### OR ########################
Console::command('get_password',function (){
    $input = Console::option('pass');
    echo $input;
});
// Run:
// php script.php get_password pass 123456

// Output: 123456

##################### OR ########################
Console::command('get_password',function (){
    $input = Console::option('pass');
    echo $input;
});
// Run:
// php script.php get_password pass=123456

// Output: 123456
```

---

Add color to text

```
Console::command('get_password',function (){
    $input = Console::option('--pass');
    echo Console::success($input);
    echo Console::error($input);
    echo Console::warning($input);
    echo Console::info($input);
    echo Console::none($input);
});
```

---

Help about commands

```
// script.php help
// or
//script.php --help
// or
//script.php -h
// or
//script.php h
```

---

Functions
---------

[](#functions)

FunctionsDescriptionExampleCommandCreate a commandConsole::Command('commandName',Closure)inputIt takes an input from the user and returns the value of the inputConsole::input('Your message')secretInputUser input will not be visible to them as they type in the consoleConsole::secretInput('You password: ')purposeAdd a description to the commandConsole::purpose('Description')optionTakes the value of an argumentConsole::option('argName')

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1246d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/63023595?v=4)[Hasan Bahrami](/maintainers/HASSAN-22)[@HASSAN-22](https://github.com/HASSAN-22)

---

Top Contributors

[![HASSAN-22](https://avatars.githubusercontent.com/u/63023595?v=4)](https://github.com/HASSAN-22 "HASSAN-22 (2 commits)")

---

Tags

phpcommandhasan

### Embed Badge

![Health badge](/badges/hasan-22-php-command/health.svg)

```
[![Health](https://phpackages.com/badges/hasan-22-php-command/health.svg)](https://phpackages.com/packages/hasan-22-php-command)
```

###  Alternatives

[league/climate

PHP's best friend for the terminal. CLImate allows you to easily output colored text, special formats, and more.

1.9k14.7M300](/packages/league-climate)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
