Download the PHP package plinker/tasks without Composer

On this page you can find all versions of the php package plinker/tasks. 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 tasks

PlinkerRPC - Tasks

The tasks component allows you to write code based tasks which are completed by a daemon, this could allow you to create a single interface to control a cluster of servers tasks.

Install

Require this package with composer using the following command:

CRON Daemon

You should create a file which will be run via cron:

cron.php

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

if (php_sapi_name() != 'cli') {
    header('HTTP/1.0 403 Forbidden');
    exit('CLI script');
}

$task = new Plinker\Tasks\Runner([
    'database' => [
        'dsn'      => 'sqlite:./.plinker/database.db',
        'host'     => '',
        'name'     => '',
        'username' => '',
        'password' => '',
        'freeze'   => false,
        'debug'    => false
    ],
    'debug'       => true,
    'log'         => true,
    'sleep_time'  => 2,
    'tmp_path'    => './.plinker',
    'auto_update' => 86400
]);

$task->daemon('Queue');

Then add a cron job:

Client

Creating a client instance is done as follows:

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

/**
 * Initialize plinker client.
 *
 * @param string $server - URL to server listener.
 * @param string $config - server secret, and/or a additional component data
 */
$client = new \Plinker\Core\Client(
    'http://example.com/server.php',
    [
        'secret' => 'a secret password',
        // database connection
        'database' => [
            'dsn'      => 'sqlite:./.plinker/database.db',
            'host'     => '',
            'name'     => '',
            'username' => '',
            'password' => '',
            'freeze'   => false,
            'debug'    => false,
        ],
        // displays output to task runner console
        'debug' => true,

        // daemon sleep time
        'sleep_time' => 1,
        'tmp_path'   => './.plinker'
    ]
);

// or using global function
$client = plinker_client('http://example.com/server.php', 'a secret password', [
    // database connection
    'database' => [
        'dsn'      => 'sqlite:./.plinker/database.db',
        'host'     => '',
        'name'     => '',
        'username' => '',
        'password' => '',
        'freeze'   => false,
        'debug'    => false,
    ],
    // displays output to task runner console
    'debug' => true,

    // daemon sleep time
    'sleep_time' => 1,
    'tmp_path'   => './.plinker'
]);

Methods

Once setup, you call the class though its namespace to its method.

Create

Create a new task, tasks with the same name will be overwritten.

Parameter Type Description Default
name string Name of task
source string Task source code
type string Type of task (php|bash)
description string Description of task
params array Default params passed to task

Call

Response

Update

Update a task.

Parameter Type Description Default
id int Id of task
name string Name of task
source string Task source code
type string Type of task (php|bash)
description string Description of task
params array Default params passed to task

Call

Response

Get

Get a task.

Parameter Type Description Default
name string Name of task

Call

Response (RedBean Object)

Get By Id

Get a task by id.

Parameter Type Description Default
id int Id of task

Call

Response (RedBean Object)

Get Task Sources

Get all tasks.

Call

Response (RedBean Object)

Status

Get the status of a task.

Parameter Type Description Default
name string Name of task

Call

Response

Run Count

Get the run count of a particular task.

Parameter Type Description Default
name string Name of task

Call

Response

Remove

Remove a task by its name.

Parameter Type Description Default
name string Name of task

Call

Response

Remove By Id

Remove a task by its id.

Parameter Type Description Default
id int Id of task

Call

Response

Get Tasks Log

Task logs are entries created, when a task is run. Use this method to get the data.

Parameter Type Description Default
tasksource_id int The id of the task source (optional)

Call

Response

Get Tasks Log Count

Task logs are entries created, when a task is run. Use this method to get the counts.

Parameter Type Description Default
tasksource_id int The id of the task (optional)

Call

Response

Remove Tasks Log

Remove a task log from the task.

Parameter Type Description Default
task_id int The id of the task

Call

Response

Get Tasks

Task logs are entries created, when a task is run. Use this method to get the data.

Parameter Type Description Default
task_id int The id of the task (optional)

Call

Response

Run

Place task entry in tasking table for deamon to run.

Parameter Type Description Default
name string Name of the task ``
params array Array of values which are passed to task ``
sleep int Sleep time between iterations, if 0 its run once 0

Call

Response

Run Now

Run a task now (task is not placed in tasking table for deamon to run), and run as the web server user.

Parameter Type Description Default
name string Name of the task ``

Call

Response

Clear

Delete all tasks.

Call

Response

Reset

Delete database. Use with caution.

Call

Response

Testing

There are no tests setup for this component.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please contact me via https://cherone.co.uk instead of using the issue tracker.

Credits

Links

Want to see an example project which uses this component?

Development Encouragement

If you use this project and make money from it or want to show your appreciation, please feel free to make a donation https://www.paypal.me/lcherone, thanks.

Sponsors

Get your company or name listed throughout the documentation and on each github repository, contact me at https://cherone.co.uk for further details.

License

The MIT License (MIT). Please see License File for more information.

See the organisations page for additional components.


All versions of tasks with dependencies

PHP Build Version
Package Version
Requires league/climate Version ^3.2
plinker/core Version >=0.1
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 plinker/tasks contains the following files

Loading the files please wait ....