mnapoli/silly
Silly is a lightweight library for building CLI apps in PHP. It wraps Symfony Console with a simple, callback-based API, optional dependency injection support, and helpers for defining commands and arguments quickly—ideal for small tools and prototypes.
silly is a Symfony Console-based CLI micro-framework, ideal for:
symfony/console if not already present).php artisan silly:command)..env or config/ files via Laravel’s helpers.| Risk Area | Mitigation Strategy |
|---|---|
| Symfony Console Version Mismatch | Pin symfony/console version to match Laravel’s (e.g., ^6.4 for Laravel 10). |
| Laravel-Specific Assumptions | Avoid hardcoding Laravel paths; use app() helper or DI for service access. |
| CLI vs. Web Conflicts | Isolate silly commands in a dedicated namespace (e.g., App\Console\Silly). |
| Testing Complexity | Use Laravel’s Artisan::call() for integration tests; mock dependencies. |
artisan) or as standalone PHP scripts?silly if it provides unique CLI composition benefits.composer require mnapoli/silly
php artisan vendor:publish --tag=silly-config.app/Console/Commands/Silly/ExampleCommand.php):
namespace App\Console\Commands\Silly;
use Silly\Command;
class ExampleCommand extends Command {
protected static $signature = 'silly:example';
public function handle() {
$this->info('Hello from Silly!');
}
}
app/Console/Kernel.php:
protected $commands = [
Commands\Silly\ExampleCommand::class,
];
public function __construct(private UserRepository $users) {}
symfony/console version compatibility.symfony/console is already present.silly commands.silly:db, silly:deploy).silly has 931 stars but may lack active maintenance (last release in 2024-10).silly adds negligible overhead.App\Console\Silly\Db, App\Console\Silly\Deploy).popen for CPU-heavy tasks).| Scenario | Mitigation |
|---|---|
| Command Crashes | Implement try-catch blocks; log errors to Laravel’s logs/ directory. |
| Dependency Injection Failures | Use @inject or constructor binding; validate services exist. |
| Symfony Console Updates | Pin symfony/console version in composer.json. |
| Laravel-Silly Conflict | Isolate silly commands in a separate service provider. |
silly’s command structure and Symfony Console basics.php artisan list to discover commands; php artisan help silly:command for usage.silly’s GitHub repo (if available) or Symfony docs.How can I help you explore Laravel packages today?