Skip to content

Commit 26ed53c

Browse files
committed
Update index.md
1 parent a646ed1 commit 26ed53c

File tree

1 file changed

+37
-16
lines changed

1 file changed

+37
-16
lines changed

index.md

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ Got a PHP project? Heard of Grunt and Gulp but don't use NodeJS? Task is a pure
2020

2121
Ask us anything on Twitter at [@taskphp](https://twitter.com/taskphp).
2222

23-
Example
24-
=======
23+
# Example
2524

2625
```php
2726
<?php
@@ -68,8 +67,7 @@ $project->addTask('css.watch', ['watch', function ($watch) {
6867
return $project;
6968
```
7069

71-
Installation
72-
============
70+
# Installation
7371

7472
Add to your `composer.json`:
7573

@@ -83,8 +81,36 @@ Add to your `composer.json`:
8381

8482
This will allow you to instantiate a `Task\Project`. To run tasks from the command line, install [task/cli](https://github.com/taskphp/cli). You should probably do this now!
8583

86-
Usage
87-
=====
84+
There are 3 options for installation:
85+
86+
## #1 Composer global (recommended)
87+
```bash
88+
$> composer global require task/cli ~0.2
89+
```
90+
If you haven't installed anything this way before you'll need to update your `PATH`:
91+
```bash
92+
export PATH=$PATH:$HOME/.composer/vendor/bin
93+
```
94+
95+
## #2 Phar
96+
97+
Download from Github:
98+
```bash
99+
$> wget -O /usr/bin/task https://github.com/task/cli/releases/v0.2.0/task.phar
100+
$> chmod +x /usr/bin/task
101+
```
102+
103+
## #3 Composer
104+
```json
105+
...
106+
"require-dev": {
107+
"task/cli": "~0.2"
108+
}
109+
...
110+
```
111+
Run at `./vendor/bin/task`.
112+
113+
# Usage
88114

89115
The only requirements are that you implement a `Taskfile` that returns a `Task\Project`:
90116

@@ -149,8 +175,7 @@ $> task greet
149175
Hello, World!
150176
```
151177

152-
Plugins
153-
=======
178+
# Plugins
154179

155180
Plugins are where the real work gets done.
156181

@@ -202,23 +227,19 @@ mbfisher
202227

203228
This is a totally pointless example but it demonstrates some core concepts.
204229

205-
DI
206-
--
230+
## DI
207231

208232
Dependency injection is used to setup plugins and inject them into tasks. `Project::inject` allows you to fill a `Pimple` container up with anything you like.
209233

210-
Injection
211-
---------
234+
## Injection
212235

213236
Plugins are injected into tasks using `Task\Injector`. Instead of a `Closure`, pass `Project::addTask` an array with your task as the last element. The preceding elements should be IDs stored in the container; they will be retrieved and passed as arguments to the task.
214237

215-
Streams
216-
-------
238+
## Streams
217239

218240
Plugins are encouraged to use NodeJS-style streams for handling data flows. `Task\Plugin\Stream\ReadableInterface` provides `read` and `pipe` methods, `Task\Plugin\Stream\WritableInterface` provides a `write` method. In the example above `ProcessPlugin::build` returns a `Task\Plugin\Process\ProcessBuilder`, which implements `ReadableInterface`, allowing us to `pipe` a `Task\Plugin\Console\Output\Output` instance to it, which implements `WritableInterface`.
219241

220-
Discussion
221-
==========
242+
## Discussion
222243

223244
* See [nikic's article on PHP over XML](https://nikic.github.io/2012/07/09/A-plea-for-less-XML-configuration-files.html) for a great argument for using pure PHP for configuration.
224245

0 commit comments

Comments
 (0)