PHPackages                             degraciamathieu/clike - 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. degraciamathieu/clike

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

degraciamathieu/clike
=====================

This package allows you to run a class with a design pattern similar to a command system

v1.2.0(5y ago)3432MITPHPPHP &gt;=7.1.0

Since Jul 25Pushed 5y ago1 watchersCompare

[ Source](https://github.com/DeGraciaMathieu/Clike)[ Packagist](https://packagist.org/packages/degraciamathieu/clike)[ Docs](https://github.com/degraciamathieu/clike)[ RSS](/packages/degraciamathieu-clike/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (2)Versions (5)Used By (0)

[![](https://camo.githubusercontent.com/b80442f4ddbd7899fcbdc176a015f00364c89a0260cf207849e2b4a5bb1295b6/68747470733a2f2f6931372e73657276696d672e636f6d2f752f6631372f31312f31332f36312f33322f636c696b6531302e706e67)](https://camo.githubusercontent.com/b80442f4ddbd7899fcbdc176a015f00364c89a0260cf207849e2b4a5bb1295b6/68747470733a2f2f6931372e73657276696d672e636f6d2f752f6631372f31312f31332f36312f33322f636c696b6531302e706e67)

 [![Scrutinizer Code Quality](https://camo.githubusercontent.com/84847b5efe4556beba23536ef0eeef67738c0c19542e5d4840bc536d2c1a59d4/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f44654772616369614d6174686965752f436c696b652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/degraciamathieu/clike/?branch=master)[![Build Status](https://camo.githubusercontent.com/eb9d3427820adef0feb1fc6dbf35efba439d29e6762d56547ddea9a76b10f523/68747470733a2f2f7472617669732d63692e6f72672f44654772616369614d6174686965752f436c696b652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/DeGraciaMathieu/Clike)[![Code Coverage](https://camo.githubusercontent.com/6ab6d15c3e109f1fb59988a31654d4c7a56e5a26f14479d89ef9ee5c3d17430b/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f44654772616369614d6174686965752f436c696b652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/DeGraciaMathieu/Clike/?branch=master)[![PHP range](https://camo.githubusercontent.com/2041b98c89dc06f42ed77b338bb60161b0c1ae64b55e9c7a7e5596744dfcc9b9/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7068702d762f44654772616369614d6174686965752f436c696b652e737667)](https://camo.githubusercontent.com/2041b98c89dc06f42ed77b338bb60161b0c1ae64b55e9c7a7e5596744dfcc9b9/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7068702d762f44654772616369614d6174686965752f436c696b652e737667) [![Latest Version on Packagist](https://camo.githubusercontent.com/1a9a927864ec2be59f45a110907fa08771e0234f9db5b415240a64c422d003af/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f64656772616369616d6174686965752f636c696b652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/degraciamathieu/clike)[![](https://camo.githubusercontent.com/7f0a4b8df38d97cf649be7ab25f407f92c2a2d7410b7efd9adf304b50235aaa7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f64656772616369616d6174686965752f636c696b652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/degraciamathieu/clike)

DeGraciaMathieu/Clike
=====================

[](#degraciamathieuclike)

The command design pattern is useful to create modular components for a command line shell application that can be expanded with more functionality implemented later by separate modules.

Installation
------------

[](#installation)

Run in console below command to download package to your project:

```
composer require degraciamathieu/clike

```

Usage
-----

[](#usage)

### Create a command

[](#create-a-command)

A command is a class that must implement the interface `DeGraciaMathieu\Clike\Contracts\Command::class`.

The following example is a valid command.

```
use DeGraciaMathieu\Clike\Lines;
use DeGraciaMathieu\Clike\Contracts;

class Clear implements Contracts\Command {

    /**
     * Get the command description
     */
    public function description() :string
    {
        return 'Command description...';
    }

    /**
     * Check if the command is executable
     */
    public function authorized() :bool
    {
        return true;
    }

    /**
     * Bind of this command
     */
    public function binding() :string
    {
        return '/clear';
    }

    /**
     * Code executed by this command
     */
    public function process() :void
    {
        //
    }

    /**
     * Output of this command
     */
    public function output() :array
    {
        return [
            new Lines\Info('Output text...'),
        ];
    }
}
```

### Execute a command

[](#execute-a-command)

Now let's play with our Clear command.

```
use DeGraciaMathieu\Clike\Command;

$command = new Command();
$command->execute(new Clear());
```

After checking that we can use this command with the `authorized` method this code will execute the `process` method of our command.

To finally execute the `output` method displaying the following result.

```
// array:2 [
//   "timestamp" => 1531339693
//   "lines" => array:1 [
//     0 => array:2 [
//       "type" => "info"
//       "content" => "Output text..."
//     ]
//   ]
// ]
```

### Execute a command with Terminal

[](#execute-a-command-with-terminal)

```
use DeGraciaMathieu\Clike\Terminal;

$terminal = new Terminal([
    Clear::class,
]);
$terminal->execute('/clear');
```

### Retrieve all available commands with Terminal

[](#retrieve-all-available-commands-with-terminal)

```
use DeGraciaMathieu\Clike\Terminal;

$terminal = new Terminal([
    Clear::class,
]);
$terminal->getAvailableCommands();

// [
//     [
//       "binding" => "/clear"
//       "description" => "Command description..."
//     ]
// ]
```

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 93% 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

Every ~353 days

Total

3

Last Release

2189d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/11473997?v=4)[DeGraciaMathieu](/maintainers/DeGraciaMathieu)[@DeGraciaMathieu](https://github.com/DeGraciaMathieu)

---

Top Contributors

[![DeGraciaMathieu](https://avatars.githubusercontent.com/u/11473997?v=4)](https://github.com/DeGraciaMathieu "DeGraciaMathieu (53 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (4 commits)")

---

Tags

clicommand-systemdesign-patternlaravelphpclilaraveldesign patterncommand system

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/degraciamathieu-clike/health.svg)

```
[![Health](https://phpackages.com/badges/degraciamathieu-clike/health.svg)](https://phpackages.com/packages/degraciamathieu-clike)
```

###  Alternatives

[phpsa/filament-dadjokes

With DadJokes every time you load your control panel you'll be greeted by an epic dad joke on the dashboard.

1714.3k](/packages/phpsa-filament-dadjokes)

PHPackages © 2026

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