Pake is a simple task runner.
Pake is a Make-like program implemented in PHP.
Tasks and dependencies are specified in standard PHP syntax.
Pakefiles (pake's version of Makefiles) are completely defined in standard PHP syntax.
These commands requires you to have Composer installed globally. Open a command console, enter your project directory and execute the following commands to download the latest stable version:
composer require --dev roukmoute/pake
First, you must write a Pakefile
file which contains the build rules.
Here's a simple example:
<?php
use PhpCsFixer\Console\Application;
use Symfony\Component\Console\Input\ArrayInput;
task(
'default',
function () {
return ['fix'];
}
);
desc('PHP Coding Standards Fixer');
task(
'fix',
function () {
$application = new Application();
$application->setAutoExit(false);
$application->run(new ArrayInput(['fix']));
}
);
This Pakefile has two tasks:
- A task named
fix
, which – upon invocation – will fix your code to follow standards in PHP:
▶ php ./vendor/bin/pake fix
- A task named
default
. This task does nothing by itself, but it has exactly one dependency, namely thefix
task.
Invoking thedefault
task will cause Pake to invoke thefix
task as well.
Running the pake
command without any options will cause it to run the
default
task in the Pakefile:
▶ php ./vendor/bin/pake
Loaded config default from ".php_cs.dist".
Using cache file ".php_cs.cache".
Type --help
for all available options.