vuongxuongminh / laravel-async

Package provide simple way to run code asynchronously for your Laravel application.
MIT License
154 stars 26 forks source link

Sorry but It doesn't work for me #37

Open vlauciani opened 1 year ago

vlauciani commented 1 year ago

Hi

After two days of desperate attempts, I am asking for your help

I'm using Laravel 9 and to start using the package I create a simple method like this:

use VXM\Async\AsyncFacade as Async;

class AsyncController extends Controller
    public function async()
    {
        for ($i = 1; $i < 20; $i++) {
            Async::run(function () use ($i) {
                sleep(1);

                return $i;
            });
        }
        var_dump(implode(', ', Async::wait()));
    }
}

the file routes/api.php contains something like:

Route::get('/async', 'AsyncController@async');

Asking the GET url: http://localhost/api/location/v2/async

I can see only:

string(0) "" 

Where am I going wrong?

Thank you.

vuongxuongminh commented 1 year ago

Can you retry on latest version?

gofortiss commented 9 months ago

Same it just didn't work

ijazahmedbhatti commented 7 months ago

its same error https://github.com/vuongxuongminh/laravel-async/issues/34