- Can I use Silly to build internal Laravel tools without bloating my project?
- Yes, Silly is designed as a micro-framework, so it adds minimal overhead. It’s ideal for small-to-medium CLI tools where full Laravel bootstrapping isn’t needed. It leverages Laravel’s Service Container and Artisan, so you get Laravel’s benefits without the weight of a full application.
- How do I install Silly in a Laravel project?
- Install via Composer with `composer require mnapoli/silly`. If Silly includes configuration, publish it using `php artisan vendor:publish --tag=silly-config`. Then, create your command classes in `app/Console/Commands/Silly/` and register them in `app/Console/Kernel.php`.
- Will Silly work with Laravel 10 and PHP 8.1+?
- Yes, Silly is tested with Laravel 10+ and requires PHP 8.1+. It aligns with Laravel’s Symfony Console version (e.g., ^6.4 for Laravel 10). For older Laravel versions, check symfony/console compatibility manually.
- Can I inject Laravel services like Eloquent models or repositories into Silly commands?
- Absolutely. Silly commands can use Laravel’s Service Container for dependency injection. For example, inject a `UserRepository` via the constructor, and Laravel’s DI will resolve it automatically. This works seamlessly with Eloquent, Queues, and other Laravel services.
- How do I test Silly commands in Laravel?
- Use Laravel’s `Artisan::call()` method for integration testing. Mock dependencies as needed, and test commands in isolation or within Laravel’s context. Silly commands can also be tested like regular Artisan commands, ensuring they integrate well with Laravel’s testing tools.
- Is Silly suitable for production-grade CLI tools, or just quick scripts?
- Silly is production-ready for internal tools, automation pipelines, and developer utilities. It’s not recommended for customer-facing CLI applications where UX consistency is critical. For production use, ensure proper error handling, logging, and documentation for non-dev teams.
- What if my project already uses Symfony Console? Will Silly cause conflicts?
- No, Silly won’t cause conflicts if your Laravel project already includes Symfony Console (which it does by default). It’s built on top of Symfony Console and integrates seamlessly with Laravel’s Artisan. Pin the symfony/console version to match Laravel’s to avoid mismatches.
- How does Silly compare to Laravel’s native Artisan or Laravel Zero?
- Silly is a middle ground: it’s lighter than full Laravel but more structured than standalone Symfony Console. Use Silly if you need modular CLI commands with Laravel integration (e.g., injecting Eloquent models). For pure CLI apps, Laravel Zero is a better fit, while Artisan suffices for simple Laravel-specific tasks.
- Can I run Silly commands outside Laravel’s context (e.g., as standalone scripts)?
- Silly commands are designed to run within Laravel’s context, typically via `php artisan`. If you need standalone scripts, consider using Symfony Console directly or Laravel Zero. Silly’s strength lies in its tight integration with Laravel’s ecosystem, including the Service Container and Artisan.
- What’s the learning curve for teams unfamiliar with Symfony Console?
- The learning curve is moderate. Since Silly is built on Symfony Console, teams already familiar with Laravel’s Artisan will adapt quickly. However, if your team lacks Symfony Console experience, expect a slight ramp-up time for advanced features like command composition or custom input handling.