junty/junty-taskrunner 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

junty/junty-taskrunner

Composer 安装命令:

composer require junty/junty-taskrunner

包简介

Task runner for Junty.

README 文档

README

Packagist Travis Scrutinizer GitHub license

Junty task runner component.

Install

$ composer require junty/junty-taskrunner

Usage

Basig usage

<?php
require 'vendor/autoload.php';

use Junty\TaskRunner\Runner\Runner;

$runner = new Runner();

$runner->task('say_hello', function () {
    echo 'hello!'; 
});

$runner->my_task_2 = function () {
    // ...
};

$runner->group('tests', function () {
    $this->task('tests_for_users', function () {
        // ...
    });

    $this->task('tests_for_admins', function () {
        // ...
    });
});

$runner->run(); // Runs all registred tasks

Methods

task

Creates a task with Junty\TaskRunner\Task\TaskInterface or callable one.

$runner->task('my_task', function () {});

// or

$runner->task(new MyTask());

group

Creates a group of tasks with Junty\TaskRunner\Task\GroupInterface or callable one.

$runner->group('my_group', function () {
    $this->task('my_task_from_group_1', function () {});

    // Another tasks
});

| A group and a task cannot have the same name!

order

Orders the execution task and groups order.

$runner->order('my_group', 'my_task', 'my_group_2');

run

Runs all tasks and groups.

$runner->run();

runTask

Runs a single registred task or instance of TaskInterface.

$runner->runTask('my_registred_task');

// or

$runner->runTask(new MyTask());

runGroup

Runs a single registred group or instance of GroupInterface.

$runner->runGroup('my_registred_group');

// or

use Junty\TaskRunner\Task\Group;

$runner->runGroup(new class() extends Group
{
    public function __construct()
    {
    }

    public function getName() : string
    {
        return 'my_group';
    }

    public function task($task, callable $task = null)
    {
    }

    public function getTasks() : TaskCollection
    {
        $collection = new TaskCollection();

        $collection->set(new MyTask());
        $collection->set(new MyOtherTask());

        return $collection;
    }
});

统计信息

  • 总下载量: 93
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-03-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固