Awesome Open Source
Awesome Open Source


The task manager for php

Latest Stable Version Total Downloads Latest Unstable Version License Build Status


Sometimes I need a tool like Gulp for my PHP projects, but I don't want to install npm only to install Gulp. I thought "I need something like Gulp, but in PHP". After a little research I found Phing, but it's not focused in minification and management for CSS/JS and related frontend stuff.

Well, I decided to write Phulp, the PHP port of Gulp! And a little curiosity: it's faster than Gulp.

PS: I made benchs using PHP 7



Like Gulp we also have plugins, and you also can create your own.

Available plugins you can find in the plugin section over the Phulp Page.

To make your plugin available in the Phulp plugin page, add the keyword "phulpplugin" in your composer.json file of your project, and don't forget to let a cool composer.json description.

And tag your github project with the tags "phulpplugin", and "phulp", to be searchable on github.


$ composer require --dev reisraff/phulp
Create your Phulpfile (the configuration file, that describes all your tasks):

use Phulp\Output as out;

// Define the default task
$phulp->task('default', function ($phulp) {
    out::outln(out::colorize('Arguments:', 'green'));
    out::outln(print_r($phulp->getArguments(), true));

    $phulp->start(['clean', 'iterate_src_folder', 'sync_command', 'async_command']);
    if ($phulp->getArgument('repeat-clean', false)) {
        out::outln(out::colorize('Repeating "clean"', 'green'));

// Define the clean task
$phulp->task('clean', function ($phulp) {
    if (! file_exists('dist')) {

// Define the iterate_src_folder task
$phulp->task('iterate_src_folder', function ($phulp) {
    // Define the source folder
        ->pipe($phulp->iterate(function ($file) {
                '%s %s',
                out::colorize('Iterated ->', 'green'),
                out::colorize($file->getFullPath() . DIRECTORY_SEPARATOR . $file->getName(), 'blue')

// Define the sync_command task
$phulp->task('sync_command', function ($phulp) {
    $command = $phulp->exec(
        'sleep 1 && echo $MSG',
            'env' => [
                'MSG' => 'Sync-command'
            'cwd' => '/tmp',
            'sync' => true, // defines sync,
            'quiet' => true,
            'onStdOut' => function ($line) { out::outln($line); },
            'onStdErr' => function ($line) { },
            'onFinish' => function ($exitCode, $stdOut, $stdErr) { },

    $exitCode = $command->getExitCode();
    $stdout = $command->getStdout();
    $stderr = $command->getStderr();


// Define the async_command task
$phulp->task('async_command', function ($phulp) {
    $command = $phulp->exec(
        'sleep 1 && echo $MSG',
            'env' => [
                'MSG' => 'Async-command'
            'cwd' => '/tmp',
            'sync' => false, // defines async,
            'quiet' => false,
            'onStdOut' => function ($line) { },
            'onStdErr' => function ($line) { },
            'onFinish' => function ($exitCode, $stdOut, $stdErr) { },


// Define the watch task
$phulp->task('watch', function ($phulp) {
    // Phulp will watch 'src' folder
        function ($phulp, $distFile) {
                '%s %s',
                out::colorize('File Changed ->', 'green'),
                out::colorize($distFile->getFullPath() . DIRECTORY_SEPARATOR . $distFile->getName(), 'blue')

Run the phulp over the Phulpfile directory

If you have not configured the bin-dir:

$ vendor/bin/phulp --help
$ vendor/bin/phulp # Will run the `default` task
$ vendor/bin/phulp --arg=repeat-clean:true # Will run the `default` task with the argument repeat-clean with value `true`
$ vendor/bin/phulp --autoload=/my/autoload/path/autoload.php # Will run the `default` task adding a alternative autoload php file
$ vendor/bin/phulp watch # Will run the `watch` task
The full documentation:



Run the example file:

$ composer install
$ cd example
$ ../bin/phulp
$ ../bin/phulp watch

Contributors Guide


$ git clone [email protected]:reisraff/phulp.git
$ cd phulp
$ composer install


First install the dependencies, and after you can run:

$ bin/phulp test


The "Issues" page from this repository is being used for TO-DO management.



Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
php (16,628
gulp (202
task (101
builder (87
task-runner (49
task-manager (44
watcher (31
assets-management (18