PHP code example of ybscript / yb-job

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

    

ybscript / yb-job example snippets


$ php init

$ php ybTask list

$ php ybTask

class ExampleCommand extends Command
{
    protected static $name = 'example';

    protected static $description = 'this is test example';

    /**
     * do execute command
     * example php ybTask example --param='hello,this param'
     * @param  Input $input
     * @param  Output $output
     * @return int|mixed
     */
    protected function execute($input, $output)
    {
        // TODO: Implement execute() method.

        $output->write('hello, this in example command');
        //get param
        print_r($input->getOpts());
        $this->write($input->getOpt('param'));
    }
}

class SiteController extends BaseController
{
    protected static $name = 'site';

    protected static $description = 'this is site example';

    /**
     * this is test command
     * example php ybTask site:test --param='hello,this param'
     * use getOpt() / boolOpt() /
     */
    public function testCommand()
    {
        var_dump(self::annotationVars());

        $this->write('hello,this is site!');
        //get param
        print_r($this->getInput()->getOpts());
        $this->write($this->getOpt('param'));
    }
}