FCM for sending multiple notifications in an efficient manner

I am retrieving push message data from database and want to send notifications in one go instead of using while loop in php.

Code:

$pushMessageDetails->DbQueryPrepare('CALL procGetAllPushMessages()');
$pushMessageDetails->DbQueryHit();
while ( $pushMessageDetails->DbQueryFetch() )
{
  //having few checks and forming postData
  //connecting using curl_setopt and executing

}