Weave 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
Console Commands
gigerit/laravel-mysql-optimizer
cursor
database
mysql
laravel
optimize
table
mariadb

Guidelines for developing robust Laravel console commands.

Install
php artisan boost:add-skill gigerit/laravel-mysql-optimizer

Save this content to: .cursor/rules/console-commands.mdc

# Console Command Development

Guidelines for developing robust Laravel console commands.

## Command Structure
- Console commands are located in [src/Console/Commands/](mdc:src/Console/Commands/)
- Follow Laravel's command naming conventions
- Use descriptive command signatures and descriptions
- Implement proper argument and option validation

## User Experience
- Provide clear, helpful command descriptions and usage examples
- Use progress bars for long-running operations
- Implement proper output formatting with colors and styling
- Include confirmation prompts for destructive operations
- Provide meaningful feedback on operation results

## Input Validation
- Validate all command arguments and options
- Provide helpful error messages for invalid input
- Support both interactive and non-interactive execution
- Handle edge cases like missing required parameters

## Command Options
- Support `--table` option for specific table selection
- Support `--database` option for multi-database environments
- Include `--queued` option for background processing
- Implement `--dry-run` for testing without execution
- Add `--verbose` for detailed output

## Error Handling
- Catch and handle database connection errors gracefully
- Provide specific error messages for different failure scenarios
- Include proper exit codes for script automation
- Log errors appropriately while providing user-friendly output

## Testing Commands
- Test commands with various argument combinations
- Verify output formatting and messaging
- Test error conditions and edge cases
- Ensure commands work in both interactive and automated environments

Console Command Development

Guidelines for developing robust Laravel console commands.

Command Structure

  • Console commands are located in src/Console/Commands/
  • Follow Laravel's command naming conventions
  • Use descriptive command signatures and descriptions
  • Implement proper argument and option validation

User Experience

  • Provide clear, helpful command descriptions and usage examples
  • Use progress bars for long-running operations
  • Implement proper output formatting with colors and styling
  • Include confirmation prompts for destructive operations
  • Provide meaningful feedback on operation results

Input Validation

  • Validate all command arguments and options
  • Provide helpful error messages for invalid input
  • Support both interactive and non-interactive execution
  • Handle edge cases like missing required parameters

Command Options

  • Support --table option for specific table selection
  • Support --database option for multi-database environments
  • Include --queued option for background processing
  • Implement --dry-run for testing without execution
  • Add --verbose for detailed output

Error Handling

  • Catch and handle database connection errors gracefully
  • Provide specific error messages for different failure scenarios
  • Include proper exit codes for script automation
  • Log errors appropriately while providing user-friendly output

Testing Commands

  • Test commands with various argument combinations
  • Verify output formatting and messaging
  • Test error conditions and edge cases
  • Ensure commands work in both interactive and automated environments
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.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo