drupal get parameters from url 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 argument from url
$current_path = substr(\Drupal::service('path.current')->getPath(), 1);
$path_args = explode('/', $current_path);