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: helpers

Console helpers

You can use Symfony's console helpers by getting them from the application:

$app->command('greet', function ($input, $output) {
    $helper = $this->getHelperSet()->get('question');

    $question = new ConfirmationQuestion('Are you sure?', false);

    if ($helper->ask($input, $output, $question)) {
        $output->writeln('Hello!');
    }
});

Running a sub-command

Silly implements a little helper to run sub-commands easily:

$app->command('init', function ($input, $output) {
    $this->runCommand('db:drop --force', $output)
    $this->runCommand('db:create', $output)
    $this->runCommand('db:fixtures --verbose', $output)
});

Desktop notifications

You can easily send desktop notifications thanks to the JoliNotif package:

Install it with Composer:

composer require jolicode/jolinotif

You can then either configure your container to inject the Notifier instance, or create it manually:

use Joli\JoliNotif\Notification;
use Joli\JoliNotif\NotifierFactory;

[…]

$notifier = NotifierFactory::create();

$app->command('greet', function () use ($notifier) {
    $notification = (new Notification)
        ->setTitle('Notification title')
        ->setBody('This is the body of your notification')
    ;

    $notifier->send($notification);
});

If you are using the PHP-DI bridge (read more here) then you can configure PHP-DI to create the Notifier instance:

use Joli\JoliNotif\Notifier;
use Joli\JoliNotif\NotifierFactory;

[…]

$builder->addDefinitions([
    Notifier::class => factory([NotifierFactory::class, 'create']),
]);

You can then directly inject the Notifier in commands:

use Joli\JoliNotif\Notifier;

$app->command('greet', function (Notifier $notifier) {
    $notification = (new Notification)
        ->setTitle('Notification title')
        ->setBody('This is the body of your notification')
    ;

    $notifier->send($notification);
});

Read more about configuring PHP-DI in Silly here.

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.
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
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope