PHP code example of bannerlog / taskman

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

    

bannerlog / taskman example snippets




desc('Simple task');
task('simple', function() {
    echo "Yeap! You have just invoked simple task!\n";
});

desc('Task with a prerequisite');
task('prerequisite', 'simple', function() {
    echo "Prerequisite task is completed.\n\n";
    echo "You can specify as many prerequisite tasks as you need.\n";
    echo "Just write them between the task name and definition of an anonymous function.\n\n";
    echo "    task(name[,'callbefore', ...], callable);\n\n";
});

group('named', function() {
    desc('Simlpe named task');
    task('task', function(){
        echo "Simple named task has been invoked.\n";
    });

    desc('Named task with a prerequisites');
    task('prerequisite', 'simple', function(){
        echo "Named prerequisite task is completed.\n\n";

        echo "If you want to call a task within the current group ";
        echo "you should place : (colon) before a prerequisite task.\n\n";
        echo "    task('name' ':callbefore', callable);\n";
        echo "    task('name' ':subgroup:anothersub:task', callable);\n\n";

        echo "If you want to call a task from a top namespace ";
        echo "you should place ^ (caret) before a prerequisite task.\n\n";
        echo "    task('name' '^callbefore', callable);\n";
        echo "    task('name' '^differentgroup:anothersubgroup:task', callable);\n\n";
    });
});

group('included', function() {
    



desc('Main task');
task('main', ':prepare', function() {
    echo "Main task has been invoked\n";
});

desc('Preparation task');
task('prepare', function() {
    echo "Prepare to invoke main task\n";
});

desc('Invoke simple task from outside the group');
task('simple', '^simple', function() {
    echo "And you have been done it from 
    
    curl -s https://getcomposer.org/installer | php
    

    php composer.phar install
    

    php vendor/bin/taskman.php -T