PHP code example of mrjulio / rapture-command

1. Go to this page and download the library: Download mrjulio/rapture-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/ */

    

mrjulio / rapture-command example snippets



namespace AppName\Domain\Command;

class DayOfWeek extends Command
{
	public static function getOptions()
    {
        return [
            'd' => ['date', self::REQUIRED, 'Date', null],
        ];
    }
    
    public function execute()
    {
    	$date = new \DateTime($this->getOption('date'));
        
        $this->output($date->format('W'));
    }
}
bash
# run inside \AppName\Domain\Command
php console.php --cmd=DayOfWeek --env=dev --date=2017-01-01