Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
Discussion options

Anyone any luck trying to get this project to work on Laravel Lumen?
I have tried adding
$app->register(Stackkit\LaravelGoogleCloudTasksQueue\CloudTasksServiceProvider::class);
To my bootstrap/app.php file

But I'm getting the error:
Unresolvable dependency resolving [Parameter #0 [ <required> $app ]] in class Illuminate\Queue\QueueManager

Anyone?

You must be logged in to vote

Hey, first things first, I'd like to say that I never tested this package with Lumen and I'm not sure I want to support it, because it's not as widely used, and it seems like most people are using plain Laravel or Octane to get more performance out of Laravel.

That said, I got it working, but it's very hacky and has a few problems:

Problem 1 - Unsolvable dependency resolving

Not sure why this happens, but others have reported it too.

This is fixed by adding these lines to bootstrap/app.php

$app->bind(Illuminate\Queue\QueueManager::class, function ($app) {
 return $app['queue'];
});

Problem 2 - Router dependency

The package needs Illuminate\Routing\Router and Lumen doesn't have it. You ...

Replies: 1 comment

Comment options

Hey, first things first, I'd like to say that I never tested this package with Lumen and I'm not sure I want to support it, because it's not as widely used, and it seems like most people are using plain Laravel or Octane to get more performance out of Laravel.

That said, I got it working, but it's very hacky and has a few problems:

Problem 1 - Unsolvable dependency resolving

Not sure why this happens, but others have reported it too.

This is fixed by adding these lines to bootstrap/app.php

$app->bind(Illuminate\Queue\QueueManager::class, function ($app) {
 return $app['queue'];
});

Problem 2 - Router dependency

The package needs Illuminate\Routing\Router and Lumen doesn't have it. You can trick the package into loading a fake 'Illuminate' router which is actually the Lumen router.

Add this class to your project:

<?php
namespace App;
class Router extends \Laravel\Lumen\Routing\Router
{
}

Then add the following to bootstrap/app.php

class_alias(App\Router::class, \Illuminate\Routing\Router::class);
$app->bind(\Illuminate\Routing\Router::class, function ($app) {
 return new Router($app);
});

Problem 3 - Still router issues 🙃

The package registers the route like this:

$router->post('handle-task', [TaskHandler::class, 'handle']);

I think Lumen doesn't understand it, because the route is not working. To fix it, register it manually (in bootstrap/app.php again):

$app->router->post('/handle-task', function () {
 return app(Stackkit\LaravelGoogleCloudTasksQueue\TaskHandler::class)->handle();
});

That made it work in the sense that a simple job is processed, but honestly not sure about the other features like different queues, scheduling, etc!

So yeah, quite hacky, but hope it helped!

You must be logged in to vote
0 replies
Answer selected by marickvantuil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /