PHPackages                             eschmar/taskchain-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. eschmar/taskchain-bundle

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

eschmar/taskchain-bundle
========================

Cronjobs made easy for symfony2.

v0.1(12y ago)031MITPHPPHP &gt;=5.3.3

Since Feb 17Pushed 12y ago1 watchersCompare

[ Source](https://github.com/eschmar/taskchain-bundle)[ Packagist](https://packagist.org/packages/eschmar/taskchain-bundle)[ Docs](https://github.com/eschmar/taskchain-bundle)[ RSS](/packages/eschmar-taskchain-bundle/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

TaskChainBundle
===============

[](#taskchainbundle)

With this bundle you can assign your services to a taskchain, which is executable by console.

Installation
------------

[](#installation)

Composer ([Packagist](https://packagist.org/packages/eschmar/taskchain-bundle)):

```
"require": {
	"eschmar/taskchain-bundle": "dev-master"
},
```

app/Appkernel.php:

```
new Eschmar\TaskChainBundle\EschmarTaskChainBundle(),
```

Usage
-----

[](#usage)

The following demo creates a new Task called `Test Task` which will simply wait 3 seconds before returning. Your service has to extend the provided abstract class `TaskAbstract`.

src/Acme/HelloBundle/Task/TestTask.php:

```
namespace Acme\HelloBundle\Task;

use Eschmar\TaskChainBundle\Task\TaskAbstract;

class TestTask extends TaskAbstract
{
	protected function init() {
		$this->name = 'Test Task';
		$this->groups[] = 'test';
	}

	public function execute() {
		sleep(3);
		return true;
	}
}
```

src/Acme/HelloBundle/Resources/config/services.yml:

```
acme_hello.taskchain_test:
    class: Acme\HelloBundle\Task\TestTask
    tags:
        - { name: taskchain }
```

Now you can execute the console command:

```
php app/console taskchain [] [--inset]
```

The command will execute all tagged services meeting the group requirement. Use the `--inset` option to exclude a group but execute all others.

Output:

```
$ app/console taskchain

   ______           __      ________          _
  /_  __/___ ______/ /__   / ____/ /_  ____ _(_)___
   / / / __ `/ ___/ //_/  / /   / __ \/ __ `/ / __ \
  / / / /_/ (__  ) ,
