PHP code example of switon / command

1. Go to this page and download the library: Download switon/command library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

switon / command example snippets


use Switon\Command\Attribute\ShortOption;
use Switon\Command\Attribute\Tool;

/**
 * Report commands.
 */
final class ReportCommand
{
    /**
     * Return a report summary.
     *
     * @param string $id Report id to inspect
     * @param bool $shout Uppercase the output
     */
    #[Tool('Returns JSON report summary by id.')]
    public function statusAction(#[ShortOption('x')] string $excluded, bool $shout = false): array {
        return ['excluded' => $excluded, 'shout' => $shout];
    }
}