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.
CLI Micro-Framework for Laravel Ecosystem: Silly is a lightweight, Symfony Console-based CLI micro-framework that aligns well with Laravel’s existing dependency injection (DI) and console command patterns. It can be integrated as a standalone CLI tool or embedded within Laravel’s artisan-like workflows.
Illuminate\Container or third-party bridges like php-di).Use Cases in Laravel:
Laravel Compatibility:
Illuminate\Container via a bridge (e.g., league/container or php-di for autowiring). Example:
$laravelContainer = app(); // Laravel's container
$sillyContainer = new \Pimple\Psr11\Container(new \Pimple\Container());
$sillyApp = new \Silly\Application();
$sillyApp->useContainer($sillyContainer, true, true); // Enable DI
AppServiceProvider).SymfonyStyle and OutputInterface are compatible with Laravel’s Illuminate\Support\Console components.Key Integration Points:
php-di for autowiring).Artisan::command() or register them as standalone CLI entry points.Medium Risk:
migrate).symfony/console, pimple) may introduce version conflicts with Laravel’s bundled Symfony components.Mitigation Strategies:
php vendor/bin/silly) or use Laravel’s Artisan::command() to proxy Silly commands.php-di) for Silly to avoid Laravel’s container complexity.php-di)?Laravel Ecosystem:
Illuminate\Container is PSR-11 compatible (via league/container or php-di), enabling seamless DI integration.Tech Stack Compatibility:
| Component | Laravel Compatibility | Notes |
|---|---|---|
| Symfony Console | ✅ High | Core to Artisan. |
| PSR-11 Container | ✅ High (via bridges) | Laravel’s container can be adapted. |
| Pimple/PHP-DI | ✅ Medium | Requires bridge or separate container. |
| Command Callables | ✅ High | Closures, classes, and methods work. |
| SymfonyStyle | ✅ High | Compatible with Laravel’s console tools. |
Phase 1: Standalone CLI Tool
php vendor/bin/silly) for non-Laravel CLI tasks.Phase 2: Artisan Proxy
// app/Providers/SillyServiceProvider.php
use Silly\Application;
use Symfony\Component\Console\Input\ArgvInput;
class SillyServiceProvider extends ServiceProvider {
public function register() {
$this->app->singleton('silly', function () {
$app = new Application();
$app->useContainer(app(), true, true); // Use Laravel's container
return $app;
});
}
public function boot() {
$silly = app('silly');
$silly->command('silly:task', function () {
// Command logic
});
$silly->getApplication()->addCommands([...]);
}
}
php artisan.Phase 3: Full Integration
symfony/console). Use replace in composer.json to avoid duplication:
"replace": {
"symfony/console": "5.4.*"
}
--help, error handling).How can I help you explore Laravel packages today?