Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Silly Laravel Package

mnapoli/silly

Silly is a lightweight CLI micro-framework built on Symfony Console. Define commands with simple signatures and PHP callables, get options/arguments parsing, helpers, and DI integration (PHP-DI or Pimple) while staying compatible with Symfony Console apps.

View on GitHub
Deep Wiki
Context7

currentMenu: definition

Command definition

Commands are defined using a string expression.

The expression must start with the command name, optionally using : as a namespace separator, for example:

  • greet
  • demo:greet

Arguments

A command can take arguments:

Description Example
Required argument greet name
Optional argument greet [name]
Array argument with 0-n values greet [name]*
Array argument with 1-n values greet name*

Options

A command can take options:

Description Example
Simple flag (boolean value) greet [--yell]
Option with an mandatory value greet [--iterations=]
Option that can be used 0-n times (array value) greet [--iterations=]*
Option with a shortcut greet [-y|--yell]

Options are always optional (duh). If an option is required, then it should be an argument.

Default values

Default values for arguments and options can be defined explicitly:

$app->command('greet [firstname] [lastname] [--age=]', function () {
    // ...
})->defaults([
    'firstname' => 'John',
    'lastname'  => 'Doe',
    'age' => 25,
]);

They can also be inferred from the callback parameters if it is a callable:

$app->command('greet [name] [--age=]', function ($name = 'John', $age = 25) {
    // ...
});

Descriptions

$app->command('greet name [--yell]', function () {
    // ...
})->descriptions('Greet someone', [
    'name'   => 'Who do you want to greet?',
    '--yell' => 'If set, the task will yell in uppercase letters',
]);

Hyphens

Arguments and options containing hyphens (-) are matched to camelCase variables:

$app->command('run [--dry-run]', function ($dryRun) {
    // ...
});

Single command applications

Sometimes you write an application with a single command, or you want one command to be the default command.

Symfony provides the setDefaultCommand() method for that, you can use it like this:

$app->command('run', /* ... */);
$app->setDefaultCommand('run');
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle