Query parameters to URL Drupal 8 code example
Example 1: drupal 8 get url query parameters
// URL query parameter.
\Drupal::request()->query->get('keys');
\Drupal::request()->query->all()
Example 2: drupal 8 get query string parameters
$query = \Drupal::request()->query->get('name');