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(5mo ago)0357↓86.1%MITPHP

Since Jan 22Pushed 5mo agoCompare

[ Source](https://github.com/imgurbot12/slap)[ Packagist](https://packagist.org/packages/imgurbot12/slap)[ RSS](/packages/imgurbot12-slap/feed)WikiDiscussions master Synced 2d 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

30

—

LowBetter than 62% of packages

Maintenance71

Regular maintenance activity

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity25

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

163d 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

[illuminate/console

The Illuminate Console package.

13046.0M6.5k](/packages/illuminate-console)[styleci/cli

The CLI tool for StyleCI

71470.5k9](/packages/styleci-cli)[winbox/args

Windows command-line formatter

20720.9k21](/packages/winbox-args)[tomatophp/filament-artisan

Simple but yet powerful library for running some artisan commands for FilamentPHP

3275.4k1](/packages/tomatophp-filament-artisan)[thettler/laravel-console-toolkit

This Package provides some usefully console features like the attribute syntax for arguments and options, validation, auto ask and casting.

324.1k](/packages/thettler-laravel-console-toolkit)

PHPackages © 2026

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