Execute time consuming tasks as late as possible in a request
PHP
Switch branches/tags
Nothing to show
Latest commit e77629d Feb 26, 2017 @lstrojny Skip hhvm
Permalink
Failed to load latest commit information.
build Build infrastructure Apr 1, 2013
src/Procrastinator Update code Feb 26, 2017
tests/Procrastinator Update code Feb 26, 2017
vendor Doctrine event support Feb 5, 2012
.gitignore Fixing interfaces May 13, 2013
.travis.yml Skip hhvm Feb 26, 2017
README.md Update README.md Jan 12, 2015
build.xml Build infrastructure Apr 1, 2013
composer.json Update code Feb 26, 2017
phpunit.xml.dist Build infrastructure Apr 1, 2013

README.md

Procrastinator for PHP: do stuff later

Gitter Build Status Dependency Status Average time to resolve an issue Percentage of issues still open

A few classes to help you executing complicated tasks (like sending mails) later.

Example using fastcgi_finish_request() to finish request before executing tasks

<?php
$procrastinator = new \Procrastinator\DeferralManager(
    new \Procrastinator\Scheduler\OnRegisterShutdownScheduler(),
    new \Procrastinator\Executor\Decorator\PhpFpmExecutorDecorator(
        new \Procrastinator\Executor\SingleThreadExecutor()
    )
);

// The rough way
$procrastinator->register(
    new \Procrastinator\Deferred\CallbackDeferred(
        'some name',
        function() {sleep(10);}
    )
);

// Or use the more convenient builder interface
$procrastinator->register(
    $procrastinator
        ->newDeferred()
        ->name('some other name')
        ->call(function() {sleep(10);}
        ->build()
);

$procrastinator->schedule();