PHP code example of strukt / tasker

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

    

strukt / tasker example snippets



/**
 * Show today's date
 */
task('date', function(){

	$date = new \DateTime();

	echo(sprintf("Now: %s\n", $date->format("Y-m-d H:i:s")));
});

/**
 * Say hello to someone
 */
task("hello", function(string $name){

    writeln(sprintf("Hello %s!", $name));
});

/**
 * Say hello to the world
 */
task('test', function(){

    go("hello", " World!");
});

/**
 * Watch changes in javascript files
 */ 
task("watch:js", function(){

	watch("app/js", function($files){

		$changes = [];
		foreach($files as $file)
			$changes[] = sprintf("%s\n", $file);

		print_r(implode("\n", $changes));
	});
});

/**
 * List directories
 */
task("lsdir", function(){

	list($output, $error) = run("ls -al", function($output){

		echo $output;
	});
});
sh
$ curl -LSs https://box-project.github.io/box2/installer.php | php