- http_build_query: documentation ( source)
<?php
$params = [
'response_type' => 'code',
'client_id' => 'client_id',
'redirect_uri' => 'redirectUri',
'scope' => [],
'access_type' => 'offline'
];
echo 'https://accounts.google.com/o/oauth2/auth'.http_build_query($params, null, '&');