Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

untymage's avatar

How to use closure jobs in lumen ?

Hey, I really need to use closure jobs in my lumen app, But it seems not supported i mean this:

dispatch(function (){
    //
});

Method Closure::handle() does not exist

The differences dispatch implementation between laravel and lumen :

laravel:

function dispatch($job)
{
    if ($job instanceof Closure) {
        $job = CallQueuedClosure::create($job);
    }

    return new PendingDispatch($job);
}

lumen:

function dispatch($job)
{
    return new PendingDispatch($job);
}

So i tried the CallQueuedClosure::create($job); alone but it not working again:

PHP Fatal error: Trait 'Illuminate\Foundation\Bus\Dispatchable' not

So, Is there any possibility we could get it to work in lumen?

0 likes
3 replies
phoenixg's avatar

Is there a way to make lumen support that?

martinbean's avatar

@phoenixg No. If you had checked the docs for Lumen 9.x, it still says closure jobs are not supported.

https://lumen.laravel.com/docs/9.x/queues:

Note: Closure jobs are not supported by Lumen.

No need to bump a 1-year-old thread for something you could have answered yourself. If you need closure-based jobs, use Laravel instead.

Please or to participate in this conversation.