I have an API created with Slim 3.
In it I have some curl execution such as sending Push notification to a user.
I want send response to requester then execute curl or any other function.
I read about Threads in PHP and use pthreads-polyfill but it sends response after finishing Thread.
Sample tested code:
 $app->get('/test', function (Request $request, Response $response) {
    PushController::publish("1111111", "HELLO");
    $result =  'OK';
    return $response->getBody()->write($result)->withStatus(200);
});