Download the PHP package toplan/task-balancer without Composer

On this page you can find all versions of the php package toplan/task-balancer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package task-balancer

Intro

Latest Stable Version Total Downloads

Lightweight and powerful task load balancing.

like the nginx load balancing :smile:

Features

Install

Usage

The $result structure:

API

Balancer

Balancer::task($name[, $data][, Closure $ready]);

Create a task instance, and return it. The closure $ready immediately called with argument $task.

$data will store in the task instance.

Balancer::run($name[, array $options])

Run the task by name, and return the result data.

The keys of $options:

Task

name($name)

set the name of task.

data($data)

Set the data of task.

driver($config[, $weight][, 'backup'], Closure $work)

Create a driver for the task. The closure $work will been called with arguments $driver and $data.

Expected $weight to be a integer, default 1.

hasDriver($name)

Whether has the specified driver.

getDriver($name)

Get driver by name.

removeDriver($name)

Remove driver from drivers' pool by name.

Driver

weight($weight)

Set the weight value of driver.

backup($is)

Set whether backup driver.

Expected $is to be boolean, default true.

data($data)

Set the data of driver.

$data will store in driver instance.

work(Closure $work);

Set the job content of driver.

$data equals to $driver->getData()

reset($config[, $weight][, 'backup'], Closure $work)

Reset driver's weight value, job content and reset whether backup.

destroy()

Remove the driver from task which belongs to.

failure()

Set the driver running failure.

success()

Set the driver run successfully.

getDriverData()

Get the data which store in driver instance.

getTaskData()

Get the data which store in task instance.

Lifecycle & Hooks

Support multiple handlers for every hooks!

Hooks

Hook name handler arguments influence of the last handler's return value
beforeCreateDriver $task, $props, $index, &$handlers, $prevReturn if an array will been merged into original props
afterCreateDriver $task, $driver, $index, &$handlers, $prevReturn -
beforeRun $task, $index, &$handlers, $prevReturn if false will stop run task and return false
beforeDriverRun $task, $driver, $index, &$handlers, $prevReturn if false will stop to use current driver and try to use next backup driver
afterDriverRun $task, $driverResult, $index, &$handlers, $prevReturn -
afterRun $task, $taskResult, $index, &$handlers, $prevReturn if not boolean will override result value

Usage

$override default false.

Dependents

License

MIT


All versions of task-balancer with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package toplan/task-balancer contains the following files

Loading the files please wait ....