PHPackages                             imgurbot12/slap - 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. imgurbot12/slap

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

imgurbot12/slap
===============

A PHP CLI Library Inspired by Rust's CLAP

0.1.0(3mo ago)0325↓16.7%MITPHP

Since Jan 22Pushed 3mo agoCompare

[ Source](https://github.com/imgurbot12/slap)[ Packagist](https://packagist.org/packages/imgurbot12/slap)[ RSS](/packages/imgurbot12-slap/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (2)Used By (0)

slap
----

[](#slap)

A PHP CLI Library Inspired by Rust's CLAP

#### Installation

[](#installation)

```
$ composer require imgurbot12/slap
```

#### Usage

[](#usage)

Slap supports a standard CLI builder mode which returns an untyped array as a result:

```
use Imgurbot12\Slap\Arg;
use Imgurbot12\Slap\Command;
use Imgurbot12\Slap\Flag;

$app = Command::new('myapp')
  ->args(Arg::new('foo')->about('foo description'))
  ->flags(Flag::new('test')->short('t')->default('hello'))
  ->subcommands(
      Command::new('bar')->args(Arg::new('baz')->default('world'));

$result = $app->parse();
print_r($result);
```

It also includes a derivation mode similar to [clap](https://github.com/clap-rs/clap):

```
use Imgurbot12\Slap\Derive\Command;
use Imgurbot12\Slap\Derive\Flag;
use Imgurbot12\Slap\Derive\Parser;
use Imgurbot12\Slap\Derive\SubCommands;

#[Command(name: 'bar')]
class Bar {
  public string $baz = 'world';
}

class Commands extends SubCommands {
  public Bar $bar;
}

#[Command(name: 'myapp')]
class MyApp extends Parser {
  /** foo description */
  public string $foo;
  #[Flag(short: 't')]
  public string $test = 'hello';

  public Commands $command;
}

$result = MyApp::parse();
print_r($result);
```

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance78

Regular maintenance activity

Popularity16

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity24

Early-stage or recently created project

 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

117d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/97e4ad65f8b27a7a27023bf20b124556c665df409865deff893a42f04a2355fc?d=identicon)[imgurbot12](/maintainers/imgurbot12)

---

Top Contributors

[![imgurbot12](https://avatars.githubusercontent.com/u/21094168?v=4)](https://github.com/imgurbot12 "imgurbot12 (18 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/imgurbot12-slap/health.svg)

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

###  Alternatives

[wp-cli/wp-cli

WP-CLI framework

5.1k17.2M320](/packages/wp-cli-wp-cli)[consolidation/annotated-command

Initialize Symfony Console commands from annotated command class methods.

22569.8M19](/packages/consolidation-annotated-command)[seld/cli-prompt

Allows you to prompt for user input on the command line, and optionally hide the characters they type

24725.8M17](/packages/seld-cli-prompt)[illuminate/console

The Illuminate Console package.

12944.1M5.1k](/packages/illuminate-console)[php-tui/php-tui

Comprehensive TUI library heavily influenced by Ratatui

589747.0k6](/packages/php-tui-php-tui)[codedungeon/php-cli-colors

Liven up you PHP Console Apps with standard colors

10210.1M26](/packages/codedungeon-php-cli-colors)

PHPackages © 2026

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