Download the PHP package molovo/phake without Composer
On this page you can find all versions of the php package molovo/phake. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package phake
Phake
A PHP task runner inspired by Make, Rake et al.
Installation and Usage
Installing phake globally
Installing per Project:
Installing ZSH Completion
Rename the file phake.zsh-completion
to _phake
, and move it somewhere in your $fpath
. /usr/local/share/zsh/site-functions/
is usually a good choice.
Usage
Default Task
Create a file called Phakefile
in the root of your project. This is just a simple PHP file. The first task you should define is called default
. This is the task that is performed if you run phake
without any arguments.
For now, we'll use it to execute a simple shell command by passing it a string:
Now you can run phake
in the same directory as your Phakefile
, and you will see Hello World!
printed to the console.
Naming tasks
The first parameter is the name of the task.
To run that task, run phake my_awesome_task
.
Multiple commands
Most tasks in phake will perform more than one simple shell command. To do that, pass an array of commands as the second parameter.
Using closures
Tasks can also contain a PHP closure, so that you can include PHP logic in your tasks. Phake uses Composer for autoloading, so that your entire project's PHP code is available to you.
Running other tasks
If you use the PHP callback method, you can call other tasks from within your tasks's callback. Just use the run()
helper.
Groups
Groups can be defined using the group()
helper. Just use the task()
helper inside the group's closure, and the task will automagically be assigned to that group.
You can run an individual task by calling phake group:task
, or run all tasks in the group by calling phake group
.
Groups can be nested indefinitely, and running a group will run all tasks and groups within that group.
Running multiple tasks
Each argument to phake
is a task, and multiple tasks can be run by simply passing them all to phake. Based on the groups example above, this would give the same results as phake group
:
Options
By default phake looks for a Phakefile
in the directory in which it is called.
To use a custom directory, pass a path to the --dir
(-d
) option.
To use a different filename, or a Phakefile outside of the directory, use the
--phakefile
(-f
) option.
To list all tasks or groups in a Phakefile, use the --tasks
or --groups
options.
To hide any output produced by your tasks, use the --quiet
(-q
) option.